diff options
-rw-r--r-- | common/core/CMakeLists.txt | 3 | ||||
-rw-r--r-- | common/core/xdgdirs.cxx (renamed from common/os/os.cxx) | 14 | ||||
-rw-r--r-- | common/core/xdgdirs.h (renamed from common/os/os.h) | 8 | ||||
-rw-r--r-- | common/os/CMakeLists.txt | 3 | ||||
-rw-r--r-- | common/rfb/CSecurityDH.cxx | 1 | ||||
-rw-r--r-- | common/rfb/CSecurityMSLogonII.cxx | 1 | ||||
-rw-r--r-- | common/rfb/CSecurityRSAAES.cxx | 2 | ||||
-rw-r--r-- | common/rfb/CSecurityTLS.cxx | 7 | ||||
-rw-r--r-- | unix/vncpasswd/CMakeLists.txt | 2 | ||||
-rw-r--r-- | unix/vncpasswd/vncpasswd.cxx | 7 | ||||
-rw-r--r-- | vncviewer/ServerDialog.cxx | 11 | ||||
-rw-r--r-- | vncviewer/parameters.cxx | 7 | ||||
-rw-r--r-- | vncviewer/vncviewer.cxx | 16 | ||||
-rw-r--r-- | win/rfb_win32/CleanDesktop.cxx | 2 | ||||
-rw-r--r-- | win/wm_hooks/wm_hooks.cxx | 1 |
15 files changed, 38 insertions, 47 deletions
diff --git a/common/core/CMakeLists.txt b/common/core/CMakeLists.txt index f09b4bd3..eb5b9d3e 100644 --- a/common/core/CMakeLists.txt +++ b/common/core/CMakeLists.txt @@ -8,7 +8,8 @@ add_library(core STATIC Region.cxx Timer.cxx string.cxx - time.cxx) + time.cxx + xdgdirs.cxx) target_link_libraries(core os) target_include_directories(core PUBLIC ${CMAKE_SOURCE_DIR}/common) diff --git a/common/os/os.cxx b/common/core/xdgdirs.cxx index 2ac70550..2628f317 100644 --- a/common/os/os.cxx +++ b/common/core/xdgdirs.cxx @@ -21,8 +21,6 @@ #include <config.h> #endif -#include <os/os.h> - #include <assert.h> #include <errno.h> #include <sys/types.h> @@ -43,6 +41,8 @@ #define mkdir(path, mode) mkdir(path) #endif +#include <core/xdgdirs.h> + static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_def) { static char dir[PATH_MAX], legacy[PATH_MAX]; @@ -109,27 +109,27 @@ static const char* getvncdir(bool userDir, const char *xdg_env, const char *xdg_ return (stat(dir, &st) != 0 && stat(legacy, &st) == 0) ? legacy : dir; } -const char* os::getuserhomedir() +const char* core::getuserhomedir() { return getvncdir(true, nullptr, nullptr); } -const char* os::getvncconfigdir() +const char* core::getvncconfigdir() { return getvncdir(false, "XDG_CONFIG_HOME", ".config"); } -const char* os::getvncdatadir() +const char* core::getvncdatadir() { return getvncdir(false, "XDG_DATA_HOME", ".local/share"); } -const char* os::getvncstatedir() +const char* core::getvncstatedir() { return getvncdir(false, "XDG_STATE_HOME", ".local/state"); } -int os::mkdir_p(const char *path_, mode_t mode) +int core::mkdir_p(const char *path_, mode_t mode) { char *path = strdup(path_); char *p; diff --git a/common/os/os.h b/common/core/xdgdirs.h index a3448070..0769ba8b 100644 --- a/common/os/os.h +++ b/common/core/xdgdirs.h @@ -17,12 +17,12 @@ * USA. */ -#ifndef OS_OS_H -#define OS_OS_H +#ifndef CORE_XDGDIRS_H +#define CORE_XDGDIRS_H #include <sys/stat.h> -namespace os { +namespace core { /* * Get user home directory. @@ -71,4 +71,4 @@ namespace os { int mkdir_p(const char *path, mode_t mode); } -#endif /* OS_OS_H */ +#endif /* CORE_XDGDIRS_H */ diff --git a/common/os/CMakeLists.txt b/common/os/CMakeLists.txt index 97031c50..3c9d8b3f 100644 --- a/common/os/CMakeLists.txt +++ b/common/os/CMakeLists.txt @@ -1,7 +1,6 @@ add_library(os STATIC Mutex.cxx - Thread.cxx - os.cxx) + Thread.cxx) target_include_directories(os PUBLIC ${CMAKE_SOURCE_DIR}/common) target_link_libraries(os core) diff --git a/common/rfb/CSecurityDH.cxx b/common/rfb/CSecurityDH.cxx index 2f0365a6..93cf6b26 100644 --- a/common/rfb/CSecurityDH.cxx +++ b/common/rfb/CSecurityDH.cxx @@ -40,7 +40,6 @@ #include <rdr/OutStream.h> #include <rdr/RandomStream.h> #include <rfb/Exception.h> -#include <os/os.h> using namespace rfb; diff --git a/common/rfb/CSecurityMSLogonII.cxx b/common/rfb/CSecurityMSLogonII.cxx index a5a99286..dfc0b658 100644 --- a/common/rfb/CSecurityMSLogonII.cxx +++ b/common/rfb/CSecurityMSLogonII.cxx @@ -39,7 +39,6 @@ #include <rdr/InStream.h> #include <rdr/OutStream.h> #include <rdr/RandomStream.h> -#include <os/os.h> using namespace rfb; diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx index 750f0d5a..513d5605 100644 --- a/common/rfb/CSecurityRSAAES.cxx +++ b/common/rfb/CSecurityRSAAES.cxx @@ -46,8 +46,6 @@ #include <rdr/AESOutStream.h> #include <rdr/RandomStream.h> -#include <os/os.h> - enum { ReadPublicKey, ReadRandom, diff --git a/common/rfb/CSecurityTLS.cxx b/common/rfb/CSecurityTLS.cxx index d23ec76b..44f738b4 100644 --- a/common/rfb/CSecurityTLS.cxx +++ b/common/rfb/CSecurityTLS.cxx @@ -36,6 +36,7 @@ #include <core/LogWriter.h> #include <core/string.h> +#include <core/xdgdirs.h> #include <rfb/CSecurityTLS.h> #include <rfb/CConnection.h> @@ -45,8 +46,6 @@ #include <rdr/TLSInStream.h> #include <rdr/TLSOutStream.h> -#include <os/os.h> - #include <gnutls/x509.h> using namespace rfb; @@ -65,7 +64,7 @@ static const char* configdirfn(const char* fn) static char full_path[PATH_MAX]; const char* configdir; - configdir = os::getvncconfigdir(); + configdir = core::getvncconfigdir(); if (configdir == nullptr) return ""; @@ -399,7 +398,7 @@ void CSecurityTLS::checkSession() /* Certificate has some user overridable problems, so TOFU time */ - hostsDir = os::getvncstatedir(); + hostsDir = core::getvncstatedir(); if (hostsDir == nullptr) { throw std::runtime_error("Could not obtain VNC state directory " "path for known hosts storage"); diff --git a/unix/vncpasswd/CMakeLists.txt b/unix/vncpasswd/CMakeLists.txt index f490a933..6ed4adaf 100644 --- a/unix/vncpasswd/CMakeLists.txt +++ b/unix/vncpasswd/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(vncpasswd vncpasswd.cxx) target_include_directories(vncpasswd PUBLIC ${CMAKE_SOURCE_DIR}/common) -target_link_libraries(vncpasswd tx rfb os) +target_link_libraries(vncpasswd core tx rfb) if(PWQUALITY_FOUND) target_link_libraries(vncpasswd pwquality) diff --git a/unix/vncpasswd/vncpasswd.cxx b/unix/vncpasswd/vncpasswd.cxx index 84d3d0df..e64ff787 100644 --- a/unix/vncpasswd/vncpasswd.cxx +++ b/unix/vncpasswd/vncpasswd.cxx @@ -31,7 +31,8 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include <os/os.h> + +#include <core/xdgdirs.h> #include <rfb/obfuscate.h> @@ -219,12 +220,12 @@ int main(int argc, char** argv) } if (fname[0] == '\0') { - const char *configDir = os::getvncconfigdir(); + const char* configDir = core::getvncconfigdir(); if (configDir == nullptr) { fprintf(stderr, "Could not determine VNC config directory path\n"); exit(1); } - if (os::mkdir_p(configDir, 0777) == -1) { + if (core::mkdir_p(configDir, 0777) == -1) { if (errno != EEXIST) { fprintf(stderr, "Could not create VNC config directory \"%s\": %s\n", configDir, strerror(errno)); diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx index 0d1bd0a7..be2850e8 100644 --- a/vncviewer/ServerDialog.cxx +++ b/vncviewer/ServerDialog.cxx @@ -43,8 +43,7 @@ #include <core/Exception.h> #include <core/LogWriter.h> #include <core/string.h> - -#include <os/os.h> +#include <core/xdgdirs.h> #include <network/TcpSocket.h> @@ -174,7 +173,7 @@ void ServerDialog::handleLoad(Fl_Widget* /*widget*/, void* data) ServerDialog *dialog = (ServerDialog*)data; if (dialog->usedDir.empty()) - dialog->usedDir = os::getuserhomedir(); + dialog->usedDir = core::getuserhomedir(); Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir.c_str(), _("TigerVNC configuration (*.tigervnc)"), @@ -214,7 +213,7 @@ void ServerDialog::handleSaveAs(Fl_Widget* /*widget*/, void* data) const char* servername = dialog->serverName->value(); const char* filename; if (dialog->usedDir.empty()) - dialog->usedDir = os::getuserhomedir(); + dialog->usedDir = core::getuserhomedir(); Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir.c_str(), _("TigerVNC configuration (*.tigervnc)"), @@ -350,7 +349,7 @@ void ServerDialog::loadServerHistory() rawHistory = loadHistoryFromRegKey(); #else - const char* stateDir = os::getvncstatedir(); + const char* stateDir = core::getvncstatedir(); if (stateDir == nullptr) throw std::runtime_error(_("Could not determine VNC state directory path")); @@ -430,7 +429,7 @@ void ServerDialog::saveServerHistory() return; #endif - const char* stateDir = os::getvncstatedir(); + const char* stateDir = core::getvncstatedir(); if (stateDir == nullptr) throw std::runtime_error(_("Could not determine VNC state directory path")); diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx index 9f40ff1e..d2a38ed4 100644 --- a/vncviewer/parameters.cxx +++ b/vncviewer/parameters.cxx @@ -35,8 +35,7 @@ #include <core/Exception.h> #include <core/LogWriter.h> #include <core/string.h> - -#include <os/os.h> +#include <core/xdgdirs.h> #include <rfb/SecurityClient.h> @@ -728,7 +727,7 @@ void saveViewerParameters(const char *filename, const char *servername) { return; #endif - const char* configDir = os::getvncconfigdir(); + const char* configDir = core::getvncconfigdir(); if (configDir == nullptr) throw std::runtime_error(_("Could not determine VNC config directory path")); @@ -806,7 +805,7 @@ char* loadViewerParameters(const char *filename) { return loadFromReg(); #endif - const char* configDir = os::getvncconfigdir(); + const char* configDir = core::getvncconfigdir(); if (configDir == nullptr) throw std::runtime_error(_("Could not determine VNC config directory path")); diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index 13d7b2a7..01da6880 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -57,9 +57,9 @@ #include <rfb/CSecurityTLS.h> #endif -#include <network/TcpSocket.h> +#include <core/xdgdirs.h> -#include <os/os.h> +#include <network/TcpSocket.h> #include <FL/Fl_PNG_Image.H> #include <FL/Fl_Sys_Menu_Bar.H> @@ -543,7 +543,7 @@ create_base_dirs() { const char *dir; - dir = os::getvncconfigdir(); + dir = core::getvncconfigdir(); if (dir == nullptr) { vlog.error(_("Could not determine VNC config directory path")); return; @@ -559,31 +559,31 @@ create_base_dirs() vlog.info(_("%%APPDATA%%\\vnc is deprecated, please switch to the %%APPDATA%%\\TigerVNC location.")); #endif - if (os::mkdir_p(dir, 0755) == -1) { + if (core::mkdir_p(dir, 0755) == -1) { if (errno != EEXIST) vlog.error(_("Could not create VNC config directory \"%s\": %s"), dir, strerror(errno)); } - dir = os::getvncdatadir(); + dir = core::getvncdatadir(); if (dir == nullptr) { vlog.error(_("Could not determine VNC data directory path")); return; } - if (os::mkdir_p(dir, 0755) == -1) { + if (core::mkdir_p(dir, 0755) == -1) { if (errno != EEXIST) vlog.error(_("Could not create VNC data directory \"%s\": %s"), dir, strerror(errno)); } - dir = os::getvncstatedir(); + dir = core::getvncstatedir(); if (dir == nullptr) { vlog.error(_("Could not determine VNC state directory path")); return; } - if (os::mkdir_p(dir, 0755) == -1) { + if (core::mkdir_p(dir, 0755) == -1) { if (errno != EEXIST) vlog.error(_("Could not create VNC state directory \"%s\": %s"), dir, strerror(errno)); diff --git a/win/rfb_win32/CleanDesktop.cxx b/win/rfb_win32/CleanDesktop.cxx index 472c193d..5205ed2e 100644 --- a/win/rfb_win32/CleanDesktop.cxx +++ b/win/rfb_win32/CleanDesktop.cxx @@ -33,8 +33,6 @@ #include <rfb_win32/CurrentUser.h> #include <rfb_win32/Registry.h> -#include <os/os.h> - #include <set> using namespace rfb; diff --git a/win/wm_hooks/wm_hooks.cxx b/win/wm_hooks/wm_hooks.cxx index a48a1738..2f04b851 100644 --- a/win/wm_hooks/wm_hooks.cxx +++ b/win/wm_hooks/wm_hooks.cxx @@ -25,7 +25,6 @@ #endif #include <wm_hooks/wm_hooks.h> -#include <os/os.h> #define SHARED __attribute__((section ("shared"), shared)) |