xtd 0.2.0
Loading...
Searching...
No Matches

◆ directory_name()

xtd::string xtd::io::file_info::directory_name ( ) const

Gets a string representing the directory's full path.

Returns
A string representing the directory's full path.
Exceptions
xtd::security::security_exceptionThe caller does not have the required permission.
xtd::io::path_too_long_exceptionThe specified path, file name, or both exceed the system-defined maximum length.
Exemple
The following example retrieves the full path of the specified file.
string file_name = R"(C:\TMP\log.txt)";
file_info file_info(file_name);
return;
console::write_line("{0} has a directoryName of {1}", file_name, file_info.directory_name());
/* This code produces output similar to the following,
* though actual results may vary by machine:
*
* C:\TMP\log.txt has a directory name of C:\TMP
*‍/
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
bool exists() const override
Gets a value indicating whether a file exists.
xtd::string directory_name() const
Gets a string representing the directory's full path.
Provides static methods for the creation, copying, deletion, moving, and opening of files,...
Definition file_info.h:41
Remarks
To get the parent directory as a xtd::io::directory_info object, use the xtd::io::file_info::directory property.
When first called, xtd::io::file_info calls xtd::io::file_info::refresh and caches information about the file. On subsequent calls, you must call xtd::io::file_info::refresh to get the latest copy of the information.