File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -779,6 +779,9 @@ const std::vector<std::string>& FileUtils::getOriginalSearchPaths() const
779779void FileUtils::setWritablePath (std::string_view writablePath)
780780{
781781 _writablePath = writablePath;
782+
783+ if (!_writablePath.empty () && (_writablePath.back () != ' /' ))
784+ _writablePath += ' /' ;
782785}
783786
784787const std::string& FileUtils::getDefaultResourceRootPath () const
Original file line number Diff line number Diff line change @@ -39,11 +39,13 @@ using namespace std;
3939namespace ax
4040{
4141
42- static std::string _checkPath (const char * path) {
42+ static std::string _checkPath (const char * path)
43+ {
4344 std::string ret;
4445 ret.resize (PATH_MAX - 1 );
4546 int n = readlink (path, &ret.front (), PATH_MAX);
46- if (n > 0 ) {
47+ if (n > 0 )
48+ {
4749 ret.resize (n);
4850 return ret;
4951 }
@@ -72,8 +74,9 @@ FileUtilsLinux::FileUtilsLinux() {}
7274bool FileUtilsLinux::init ()
7375{
7476 // application path
75- if (s_exeDir.empty ()) {
76- s_exeDir = _checkPath (" /proc/self/exe" );
77+ if (s_exeDir.empty ())
78+ {
79+ s_exeDir = _checkPath (" /proc/self/exe" );
7780 auto slash = s_exeDir.find_last_of (' /' );
7881 assert (slash != std::string::npos);
7982 s_exeName = s_exeDir.substr (slash + 1 );
@@ -104,9 +107,9 @@ bool FileUtilsLinux::init()
104107 xdgConfigPath = xdg_config_path;
105108 }
106109 _writablePath = xdgConfigPath;
107- _writablePath += " / " ;
110+ _writablePath += ' / ' ;
108111 _writablePath += s_exeName;
109- _writablePath += " / " ;
112+ _writablePath += ' / ' ;
110113
111114 bool ret = FileUtils::init ();
112115
@@ -140,4 +143,4 @@ bool FileUtilsLinux::isFileExistInternal(std::string_view path) const
140143 return (stat (path.data (), &sts) == 0 ) && S_ISREG (sts.st_mode );
141144}
142145
143- }
146+ } // namespace ax
Original file line number Diff line number Diff line change @@ -47,9 +47,6 @@ class AX_DLL FileUtilsLinux : public FileUtils
4747protected:
4848 FileUtilsLinux ();
4949
50- private:
51- std::string _writablePath;
52-
5350public:
5451 /* override functions */
5552 bool init () override ;
You can’t perform that action at this time.
0 commit comments