diff --git a/bin/main.cpp b/bin/main.cpp index 3073736f99c8c461bf19fea372166bfb43d81d12..bb48e2c3d161cce08f2fbf5d4dc605126c31363b 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -54,7 +54,7 @@ print_title() { std::cout << "Jami Daemon " << DRing::version() - << ", by Savoir-faire Linux 2004-2018" << std::endl + << ", by Savoir-faire Linux 2004-2019" << std::endl << "https://jami.net/" << std::endl #ifdef RING_VIDEO << "[Video support enabled]" << std::endl diff --git a/bin/osxmain.cpp b/bin/osxmain.cpp index 3facf7b358f25a40fa1da3d9f36b5654768d3a7f..f1c3face10b6acac4d49244b1ec6c94110fb3459 100644 --- a/bin/osxmain.cpp +++ b/bin/osxmain.cpp @@ -43,7 +43,7 @@ print_title() { std::cout << "Jami Daemon " << DRing::version() - << ", by Savoir-faire Linux 2004-2018" << std::endl + << ", by Savoir-faire Linux 2004-2019" << std::endl << "https://jami.net/" << std::endl #ifdef RING_VIDEO << "[Video support enabled]" << std::endl diff --git a/bin/winmain.cpp b/bin/winmain.cpp index f7e6eeaf622612efdf47bf1ee3dc5a556a1ea2d8..d6991c50b223d7259efeddc8e8279de31022dad9 100644 --- a/bin/winmain.cpp +++ b/bin/winmain.cpp @@ -47,7 +47,7 @@ print_title() { std::cout << "Jami Daemon " << DRing::version() - << ", by Savoir-faire Linux 2004-2018" << std::endl + << ", by Savoir-faire Linux 2004-2019" << std::endl << "https://jami.net/" << std::endl #ifdef RING_VIDEO << "[Video support enabled]" << std::endl diff --git a/configure.ac b/configure.ac index 3880c95f0cf9e542b961df4ae70ace4aa2e9a481..fc7ec1326f1f1b6b3d38151c21815ce8bec58d15 100644 --- a/configure.ac +++ b/configure.ac @@ -2,9 +2,9 @@ dnl Jami - configure.ac for automake 1.9 and autoconf 2.59 dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([Ring Daemon],[7.5.0],[ring@gnu.org],[ring]) +AC_INIT([Jami Daemon],[7.5.0],[ring@gnu.org],[jami]) -AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2018]]) +AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2019]]) AC_REVISION([$Revision$]) dnl Where to find configure files diff --git a/src/fileutils.cpp b/src/fileutils.cpp index 409bcab17484b50946cfbdfa4f104505c868e9ce..70915a4c2277806d0d5dfb56c1432110c5b56b5c 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -500,7 +500,7 @@ void set_program_dir(char *program_path) #endif std::string -get_cache_dir() +get_cache_dir(const char* pkg) { #ifdef RING_UWP std::vector<std::string> paths; @@ -530,16 +530,22 @@ get_cache_dir() #elif defined(__APPLE__) return get_home_dir() + DIR_SEPARATOR_STR + "Library" + DIR_SEPARATOR_STR + "Caches" - + DIR_SEPARATOR_STR + PACKAGE; + + DIR_SEPARATOR_STR + pkg; #else return get_home_dir() + DIR_SEPARATOR_STR + - ".cache" + DIR_SEPARATOR_STR + PACKAGE; + ".cache" + DIR_SEPARATOR_STR + pkg; #endif #ifndef RING_UWP } #endif } +std::string +get_cache_dir() +{ + return get_cache_dir(PACKAGE); +} + std::string get_home_dir() { @@ -585,7 +591,7 @@ get_home_dir() } std::string -get_data_dir() +get_data_dir(const char* pkg) { #if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) std::vector<std::string> paths; @@ -596,7 +602,7 @@ get_data_dir() #elif defined(__APPLE__) return get_home_dir() + DIR_SEPARATOR_STR + "Library" + DIR_SEPARATOR_STR + "Application Support" - + DIR_SEPARATOR_STR + PACKAGE; + + DIR_SEPARATOR_STR + pkg; #elif defined (RING_UWP) std::vector<std::string> paths; emitSignal<DRing::ConfigurationSignal::GetAppDataPath>("", &paths); @@ -612,16 +618,22 @@ get_data_dir() #else const std::string data_home(XDG_DATA_HOME); if (not data_home.empty()) - return data_home + DIR_SEPARATOR_STR + PACKAGE; + return data_home + DIR_SEPARATOR_STR + pkg; // "If $XDG_DATA_HOME is either not set or empty, a default equal to // $HOME/.local/share should be used." return get_home_dir() + DIR_SEPARATOR_STR ".local" DIR_SEPARATOR_STR - "share" DIR_SEPARATOR_STR + PACKAGE; + "share" DIR_SEPARATOR_STR + pkg; #endif } std::string -get_config_dir() +get_data_dir() +{ + return get_data_dir(PACKAGE); +} + +std::string +get_config_dir(const char* pkg) { #if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS) std::vector<std::string> paths; @@ -646,14 +658,14 @@ get_config_dir() #if defined(__APPLE__) std::string configdir = fileutils::get_home_dir() + DIR_SEPARATOR_STR + "Library" + DIR_SEPARATOR_STR + "Application Support" - + DIR_SEPARATOR_STR + PACKAGE; + + DIR_SEPARATOR_STR + pkg; #else std::string configdir = fileutils::get_home_dir() + DIR_SEPARATOR_STR + - ".config" + DIR_SEPARATOR_STR + PACKAGE; + ".config" + DIR_SEPARATOR_STR + pkg; #endif const std::string xdg_env(XDG_CONFIG_HOME); if (not xdg_env.empty()) - configdir = xdg_env + DIR_SEPARATOR_STR + PACKAGE; + configdir = xdg_env + DIR_SEPARATOR_STR + pkg; if (fileutils::recursive_mkdir(configdir.data(), 0700) != true) { // If directory creation failed @@ -664,6 +676,12 @@ get_config_dir() #endif } +std::string +get_config_dir() +{ + return get_config_dir(PACKAGE); +} + bool recursive_mkdir(const std::string& path, mode_t mode) { diff --git a/src/fileutils.h b/src/fileutils.h index cac46cda0b4fb5a9c511dbc1121dd226ee4bf8b6..c54476cfdd0ff2fe7f133f4ceeff044bba2aaec5 100644 --- a/src/fileutils.h +++ b/src/fileutils.h @@ -56,6 +56,10 @@ namespace ring { namespace fileutils { std::string get_home_dir(); + std::string get_config_dir(const char* pkg); + std::string get_data_dir(const char* pkg); + std::string get_cache_dir(const char* pkg); + std::string get_config_dir(); std::string get_data_dir(); std::string get_cache_dir(); diff --git a/src/manager.cpp b/src/manager.cpp index c3753cdcec0fc1ce98ed89d93bf5380d7ccf1cae..d3cc005f7587204a9f23c489ce8c4f9b4739da15 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -107,6 +107,7 @@ using ConferenceMap = std::map<std::string, std::shared_ptr<Conference>>; using CallIDSet = std::set<std::string>; static constexpr int ICE_INIT_TIMEOUT {10}; +static constexpr const char* PACKAGE_OLD = "ring"; std::atomic_bool Manager::initialized = {false}; @@ -136,6 +137,15 @@ restore_backup(const std::string &path) copy_over(backup_path, path); } +void +check_rename(const std::string& old_dir, const std::string& new_dir) +{ + if (old_dir != new_dir and fileutils::isDirectory(old_dir) and not fileutils::isDirectory(new_dir)) { + RING_WARN() << "Migrating" << old_dir << " to " << new_dir; + std::rename(old_dir.c_str(), new_dir.c_str()); + } +} + /** * Set OpenDHT's log level based on the DHTLOGLEVEL environment variable. * DHTLOGLEVEL = 0 minimum logging (=disable) @@ -687,7 +697,7 @@ Manager::init(const std::string &config_file) throw std::runtime_error(#ret " failed"); \ } while (0) - srand(time(NULL)); // to get random number for RANDOM_PORT + srand(time(nullptr)); // to get random number for RANDOM_PORT // Initialize PJSIP (SIP and ICE implementation) PJSIP_TRY(pj_init()); @@ -704,6 +714,10 @@ Manager::init(const std::string &config_file) setDhtLogLevel(); + check_rename(fileutils::get_cache_dir(PACKAGE_OLD), fileutils::get_cache_dir()); + check_rename(fileutils::get_data_dir(PACKAGE_OLD), fileutils::get_data_dir()); + check_rename(fileutils::get_config_dir(PACKAGE_OLD), fileutils::get_config_dir()); + pimpl_->ice_tf_.reset(new IceTransportFactory()); pimpl_->path_ = config_file.empty() ? pimpl_->retrieveConfigPath() : config_file;