#include <xtd/xtd>
class touch {
public:
static auto main(const std::vector<string>& args) {
if (args.size() > 0) {
if (file::exists(args[0])) {
touch_file(fi);
} else {
console::write_line("Could not find the file: {0}.", args[0]);
}
} else {
console::write_line("No file was specified.");
}
}
console::write_line(
"Touching: {0}", fsi.
full_name());
try {
auto now = date_time::now();
fsi.
creation_time(now).last_write_time(now).last_access_time(now);
console::write_line(
"Error: {0}",
e.message());
}
}
};
Defines the base class for predefined exceptions in the xtd namespace.
Definition exception.h:26
Provides static methods for the creation, copying, deletion, moving, and opening of files,...
Definition file_info.h:41
const xtd::date_time & creation_time() const
Gets the creation time of the current file or directory.
xtd::string full_name() const
Gets the full path of the directory or file.
Provides the base class for both xtd::io::file_info and xtd::io::directory_info objects.
Definition file_system_info.h:87
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.h:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10