diff options
author | 2022-12-16 14:03:59 -0500 | |
---|---|---|
committer | 2022-12-17 06:03:59 +1100 | |
commit | 13910382a5e846677f30d1645bfb44e4983de557 (patch) | |
tree | bc75e208d5dc4305a6721dff63efaec2864db178 /src/osd/modules/file | |
parent | 14c3d33e86ceeeeb57c44cb7d6aa85685f79813a (diff) |
osd/modules/file: Don't magically substitute environment variables when opening files. (#9859)
* util/options.cpp: Added option types for single and multiple paths.
* util/options.cpp: Substitute environment variables in values from defaults and INI files.
* ui/dirmenu.cpp: Removed hard-coded list of multi-path options.
* plugins: Don't substitute environment variables in path options.
Diffstat (limited to 'src/osd/modules/file')
-rw-r--r-- | src/osd/modules/file/posixdir.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/file/posixfile.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/file/winfile.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/file/winrtfile.cpp | 6 |
4 files changed, 3 insertions, 13 deletions
diff --git a/src/osd/modules/file/posixdir.cpp b/src/osd/modules/file/posixdir.cpp index efe68c2eda9..282a58acfc9 100644 --- a/src/osd/modules/file/posixdir.cpp +++ b/src/osd/modules/file/posixdir.cpp @@ -193,7 +193,7 @@ bool posix_directory::open_impl(std::string const &dirname) { assert(!m_fd); - m_path = osd_subst_env(dirname); + m_path = dirname; m_fd.reset(::opendir(m_path.c_str())); return bool(m_fd); } diff --git a/src/osd/modules/file/posixfile.cpp b/src/osd/modules/file/posixfile.cpp index 3b0e7b4b537..c5ce8bf7b4e 100644 --- a/src/osd/modules/file/posixfile.cpp +++ b/src/osd/modules/file/posixfile.cpp @@ -257,8 +257,6 @@ std::error_condition osd_file::open(std::string const &path, std::uint32_t openf for (auto it = dst.begin(); it != dst.end(); ++it) *it = (INVPATHSEPCH == *it) ? PATHSEPCH : *it; #endif - try { dst = osd_subst_env(dst); } - catch (...) { return std::errc::not_enough_memory; } // attempt to open the file int fd = -1; diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp index 173021121f1..84c754cdd6f 100644 --- a/src/osd/modules/file/winfile.cpp +++ b/src/osd/modules/file/winfile.cpp @@ -161,12 +161,8 @@ DWORD create_path_recursive(TCHAR *path) // osd_open //============================================================ -std::error_condition osd_file::open(std::string const &orig_path, uint32_t openflags, ptr &file, std::uint64_t &filesize) noexcept +std::error_condition osd_file::open(std::string const &path, uint32_t openflags, ptr &file, std::uint64_t &filesize) noexcept { - std::string path; - try { path = osd_subst_env(orig_path); } - catch (...) { return std::errc::not_enough_memory; } - if (win_check_socket_path(path)) return win_open_socket(path, openflags, file, filesize); else if (win_check_ptty_path(path)) diff --git a/src/osd/modules/file/winrtfile.cpp b/src/osd/modules/file/winrtfile.cpp index 3de1c19605d..5053f6e0199 100644 --- a/src/osd/modules/file/winrtfile.cpp +++ b/src/osd/modules/file/winrtfile.cpp @@ -160,12 +160,8 @@ DWORD create_path_recursive(TCHAR *path) // osd_open //============================================================ -osd_file::error osd_file::open(std::string const &orig_path, uint32_t openflags, ptr &file, std::uint64_t &filesize) +osd_file::error osd_file::open(std::string const &path, uint32_t openflags, ptr &file, std::uint64_t &filesize) { - std::string path; - try { path = osd_subst_env(orig_path); } - catch (...) { return std::errc::not_enough_memory; } - if (win_check_socket_path(path)) return win_open_socket(path, openflags, file, filesize); else if (win_check_ptty_path(path)) |