From 0887aee8c54d0ed51bb2031431e2bcdafebb4c6e Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:23:19 +0200 Subject: 5.13 --- lib/ffs_paths.h | 106 ++------------------------------------------------------ 1 file changed, 3 insertions(+), 103 deletions(-) (limited to 'lib/ffs_paths.h') diff --git a/lib/ffs_paths.h b/lib/ffs_paths.h index 2aef2322..cb0b9c3c 100644 --- a/lib/ffs_paths.h +++ b/lib/ffs_paths.h @@ -7,10 +7,7 @@ #ifndef STANDARDPATHS_H_INCLUDED #define STANDARDPATHS_H_INCLUDED -#include #include -#include -#include namespace zen { @@ -18,108 +15,11 @@ namespace zen //global program directories //------------------------------------------------------------------------------ Zstring getResourceDir(); //resource directory WITH path separator at end -Zstring getConfigDir(); //config directory WITH path separator at end +Zstring getConfigDir (); //config directory WITH path separator at end //------------------------------------------------------------------------------ -Zstring getLauncher(); //full path to application launcher C:\...\FreeFileSync.exe -bool isPortableVersion(); - - - - - - - - - - - - - -//---------------- implementation ---------------- -namespace impl -{ -inline -const Zstring& getBinaryDir() //directory containing executable WITH path separator at end -{ - static Zstring instance = beforeLast(utfCvrtTo(wxStandardPaths::Get().GetExecutablePath()), FILE_NAME_SEPARATOR) + Zstring(FILE_NAME_SEPARATOR); //extern linkage! - return instance; -} - -#ifdef FFS_WIN -inline -Zstring getInstallDir() //root install directory WITH path separator at end -{ - return beforeLast(beforeLast(getBinaryDir(), FILE_NAME_SEPARATOR), FILE_NAME_SEPARATOR) + FILE_NAME_SEPARATOR; -} -#endif -} - - -inline -bool isPortableVersion() -{ -#ifdef FFS_WIN - static const bool isPortable = !fileExists(impl::getInstallDir() + L"uninstall.exe"); //this check is a bit lame... - -#elif defined FFS_LINUX - static const bool isPortable = !endsWith(impl::getBinaryDir(), "/bin/"); //this check is a bit lame... -#endif - return isPortable; -} - - -inline -Zstring getResourceDir() -{ -#ifdef FFS_WIN - return impl::getInstallDir(); - -#elif defined FFS_LINUX - if (isPortableVersion()) - return impl::getBinaryDir(); - else //use OS' standard paths - return appendSeparator(toZ(wxStandardPathsBase::Get().GetResourcesDir())); -#endif -} - - -inline -Zstring getConfigDir() -{ - if (isPortableVersion()) -#ifdef FFS_WIN - return impl::getInstallDir(); -#elif defined FFS_LINUX - //wxString(wxT(".")) + zToWx(FILE_NAME_SEPARATOR) -> don't use current working directory - //avoid surprises with GlobalSettings.xml being newly created in each working directory - return impl::getBinaryDir(); -#endif - else //use OS' standard paths - { - Zstring userDirectory = toZ(wxStandardPathsBase::Get().GetUserDataDir()); - - if (!dirExists(userDirectory)) - try - { - makeDirectory(userDirectory); //only top directory needs to be created: no recursion necessary - } - catch (const FileError&) {} - - return appendSeparator(userDirectory); - } -} - - -inline -Zstring getLauncher() -{ -#ifdef FFS_WIN - return impl::getInstallDir() + Zstr("FreeFileSync.exe"); -#elif defined FFS_LINUX - return impl::getBinaryDir() + Zstr("FreeFileSync"); -#endif -} +Zstring getFreeFileSyncLauncher(); //full path to application launcher C:\...\FreeFileSync.exe +bool manualProgramUpdateRequired(); } #endif // STANDARDPATHS_H_INCLUDED -- cgit