mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-10 06:31:49 +00:00
Store update-log.txt log file in the correct location under Windows
This is the same location that Mendeley Desktop stores its data files ($LOCAL_APPDATA/$ORGANIZATION_NAME/$APP_NAME)
This commit is contained in:
parent
56e476b33d
commit
9d3c02e31c
2 changed files with 22 additions and 5 deletions
|
@ -4,11 +4,17 @@
|
|||
#include "Platform.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef PLATFORM_UNIX
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_UNIX
|
||||
std::string homeDir()
|
||||
{
|
||||
|
@ -43,7 +49,17 @@ std::string appDataPath(const std::string& organizationName,
|
|||
// TODO - Mac implementation
|
||||
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
// TODO - Windows implementation
|
||||
char buffer[MAX_PATH+1];
|
||||
if (SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0 /* hToken */, SHGFP_TYPE_CURRENT, buffer) == S_OK)
|
||||
{
|
||||
std::string path = FileUtils::toUnixPathSeparators(notNullString(buffer));
|
||||
path += '/' + organizationName + '/' + appName;
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -92,11 +92,12 @@ class FileUtils
|
|||
*/
|
||||
static void extractFromZip(const char* zipFile, const char* src, const char* dest) throw (IOException);
|
||||
|
||||
/** Returns a copy of the path 'str' with Windows-style '\'
|
||||
* dir separators converted to Unix-style '/' separators
|
||||
*/
|
||||
static std::string toUnixPathSeparators(const std::string& str);
|
||||
|
||||
private:
|
||||
static int toUnixPermissions(int qtPermissions);
|
||||
|
||||
// returns a copy of the path 'str' with Windows-style '\'
|
||||
// dir separators converted to Unix-style '/' separators
|
||||
static std::string toUnixPathSeparators(const std::string& str);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue