Skip to content

Commit ab3e45d

Browse files
[System::IO] fix the windows builds for non POSIX directory functions
1 parent 1073a3a commit ab3e45d

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/framework/System/IO/Directory.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,23 @@ Array<System::IO::FileInfo> System::IO::DirectoryInfo::GetFiles()
4444
#endif
4545
return files.ToArray();
4646
}
47+
48+
void Directory::CreateDirectory(const System::String& file)
49+
{
50+
#ifdef SUPPORT_DIRENT
51+
mkdir(file.c_str(),
52+
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
53+
#else
54+
::CreateDirectory(file.c_str(),nullptr);
55+
#endif
56+
}
57+
58+
/// delete a named directory
59+
void Directory::Delete(const System::String& file)
60+
{
61+
#ifdef SUPPORT_DIRENT
62+
rmdir(file.c_str());
63+
#else
64+
::RemoveDirectory(file.c_str());
65+
#endif
66+
}

src/framework/System/IO/Directory.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,11 @@ namespace System
2020
{
2121
public:
2222
/// determine if the file exists
23-
static void CreateDirectory(const System::String& file)
24-
{
25-
mkdir(file.str().c_str(),
26-
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
27-
}
23+
static void CreateDirectory(const System::String& file);
2824

2925
/// delete a named directory
30-
static void Delete(const System::String& file)
31-
{
32-
rmdir(file.str().c_str());
33-
}
34-
26+
static void Delete(const System::String& file);
27+
3528
};
3629

3730
/// directory info class

0 commit comments

Comments
 (0)