Bläddra i källkod

Replace deprecated Windows mkdir implementation

Patrick-Christopher Mattulat 1 år sedan
förälder
incheckning
f1ae1c713b
2 ändrade filer med 5 tillägg och 5 borttagningar
  1. 1 1
      include/ls-std/io/File.hpp
  2. 4 4
      source/ls-std/io/File.cpp

+ 1 - 1
include/ls-std/io/File.hpp

@@ -99,7 +99,7 @@ namespace ls::std::io
 #ifdef _WIN32
       [[nodiscard]] static ::std::list<::std::string> _listWindows(const ::std::string &_path, bool withDirectories);
 #endif
-      [[nodiscard]] static bool _mkdir(const ::std::string &_path);
+      [[nodiscard]] static bool _makeDirectory(const ::std::string &_path);
       [[nodiscard]] static ::std::string _normalizePath(::std::string _path);
       [[nodiscard]] static ::std::string _reduceSeparators(const ::std::string &_path);
       static void _remove(const ::std::string &_path);

+ 4 - 4
source/ls-std/io/File.cpp

@@ -182,7 +182,7 @@ time_t ls::std::io::File::lastModified()
 
 void ls::std::io::File::makeDirectory()
 {
-  if (!ls::std::io::File::_mkdir(this->absoluteFilePath))
+  if (!ls::std::io::File::_makeDirectory(this->absoluteFilePath))
   {
     throw ls::std::core::FileOperationException{};
   }
@@ -200,7 +200,7 @@ void ls::std::io::File::makeDirectories()
 
     if (!ls::std::io::File::_exists(currentHierarchy + separator) && !currentHierarchy.empty())
     {
-      if (!ls::std::io::File::_mkdir(currentHierarchy))
+      if (!ls::std::io::File::_makeDirectory(currentHierarchy))
       {
         throw ls::std::core::FileOperationException{}; // TODO: add missing test
       }
@@ -567,12 +567,12 @@ time_t ls::std::io::File::_lastModified(const ::std::string &_path)
 
 #endif
 
-bool ls::std::io::File::_mkdir(const ::std::string &_path)
+bool ls::std::io::File::_makeDirectory(const ::std::string &_path)
 {
   int result;
 
 #ifdef _WIN32
-  result = mkdir(_path.c_str());
+  result = _mkdir(_path.c_str());
 #endif
 
 #if defined(unix) || defined(__APPLE__)