xtd::argument_exception | path contains invalid characters such as ", <, >, or |.
@exception xtd::io::path_too_long_exception The specified path, file name, or both exceed the system-defined maximum length.
@par Examples
The following example uses this constructor to create the specified directory and subdirectory, and demonstrates that a directory that contains subdirectories cannot be deleted.
@icode{cpp}
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::io;
class program {
public:
static auto main() {
// Specify the directories you want to manipulate.
directory_info di1(R"(c:\MyDir)");
directory_info di2(R"(c:\MyDir\temp)");
try {
// Create the directories.
di1.create();
di2.create();
// This operation will not be allowed because there are subdirectories.
console::write_line("I am about to attempt to delete {0}.", di1.name());
di1.remove();
console::write_line("The delete operation was successful, which was unexpected.");
} catch (const exception&) {
console::write_line("The delete operation failed as expected.");
}
}
};
startup_(program::main);
@endicode
@remarks This constructor does not check if a directory exists. This constructor is a placeholder for a string that is used to access the disk in subsequent operations.
@remarks For a list of common I/O tasks, see <a href="https://gammasoft71.github.io/xtd/docs/documentation/Guides/xtd.core/Common%20I%3AO%20tasks" >Common I/O Tasks. |