Просмотр исходного кода

file_util: return string by const reference for GetExeDirectory()

This disallows modifying the internal string buffer (which shouldn't be
modified anyhow).
Lioncash 8 лет назад
Родитель
Сommit
63e64f0131
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      src/common/file_util.cpp
  2. 1 1
      src/common/file_util.h

+ 1 - 1
src/common/file_util.cpp

@@ -592,7 +592,7 @@ std::string GetBundleDirectory() {
 #endif
 
 #ifdef _WIN32
-std::string& GetExeDirectory() {
+const std::string& GetExeDirectory() {
     static std::string exe_path;
     if (exe_path.empty()) {
         wchar_t wchar_exe_path[2048];

+ 1 - 1
src/common/file_util.h

@@ -133,7 +133,7 @@ std::string GetBundleDirectory();
 #endif
 
 #ifdef _WIN32
-std::string& GetExeDirectory();
+const std::string& GetExeDirectory();
 std::string AppDataRoamingDirectory();
 #endif