Prefer Hush/HUSH3 to Komodo/HUSH3 if both exist, mac edition
This commit is contained in:
29
src/util.cpp
29
src/util.cpp
@@ -512,6 +512,8 @@ boost::filesystem::path GetDefaultDataDir()
|
|||||||
// ~/.hush was actually used by the original 1.x version of Hush, but we will
|
// ~/.hush was actually used by the original 1.x version of Hush, but we will
|
||||||
// only make subdirectories inside of it, so we won't be able to overwrite
|
// only make subdirectories inside of it, so we won't be able to overwrite
|
||||||
// an old wallet.dat from the Ice Ages :)
|
// an old wallet.dat from the Ice Ages :)
|
||||||
|
|
||||||
|
fs::path pathRet;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Windows
|
// Windows
|
||||||
pathRet = GetSpecialFolderPath(CSIDL_APPDATA) / "Hush" / symbol;
|
pathRet = GetSpecialFolderPath(CSIDL_APPDATA) / "Hush" / symbol;
|
||||||
@@ -531,7 +533,6 @@ boost::filesystem::path GetDefaultDataDir()
|
|||||||
}
|
}
|
||||||
return pathRet;
|
return pathRet;
|
||||||
#else
|
#else
|
||||||
fs::path pathRet;
|
|
||||||
char* pszHome = getenv("HOME");
|
char* pszHome = getenv("HOME");
|
||||||
if (pszHome == NULL || strlen(pszHome) == 0)
|
if (pszHome == NULL || strlen(pszHome) == 0)
|
||||||
pathRet = fs::path("/");
|
pathRet = fs::path("/");
|
||||||
@@ -543,17 +544,27 @@ boost::filesystem::path GetDefaultDataDir()
|
|||||||
TryCreateDirectory(pathRet);
|
TryCreateDirectory(pathRet);
|
||||||
fs::path tmppath;
|
fs::path tmppath;
|
||||||
tmppath = pathRet;
|
tmppath = pathRet;
|
||||||
tmppath /= "Komodo";
|
tmppath /= "Hush";
|
||||||
if(fs::is_directory(pathRet)) {
|
|
||||||
//legacy directory, use that
|
// create Library/Application Support/Hush if it doesn't exist
|
||||||
TryCreateDirectory(tmppath);
|
TryCreateDirectory(tmppath);
|
||||||
|
|
||||||
|
// Always use Hush/HUSH3 if it exists
|
||||||
|
if(fs::is_directory(tmppath / symbol)) {
|
||||||
return tmppath / symbol;
|
return tmppath / symbol;
|
||||||
} else {
|
} else {
|
||||||
// New directory :)
|
// Check for legacy dir
|
||||||
tmppath = pathRet;
|
tmppath = pathRet;
|
||||||
tmppath /= "Hush";
|
tmppath /= "Komodo";
|
||||||
TryCreateDirectory(tmppath);
|
//TryCreateDirectory(tmppath);
|
||||||
return tmppath / symbol;
|
if(fs::is_directory( tmppath / symbol) {
|
||||||
|
// Found legacy dir, use that
|
||||||
|
return tmppath / symbol;
|
||||||
|
} else {
|
||||||
|
// For new clones, use Hush/HUSH3
|
||||||
|
tmppath = pathRet / "Hush" / HUSH3;
|
||||||
|
}
|
||||||
|
return tmppath;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Unix
|
// Unix
|
||||||
|
|||||||
Reference in New Issue
Block a user