mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 14:33:04 +00:00
fix code format for read config file data.
This commit is contained in:
@@ -78,13 +78,19 @@ namespace common
|
||||
std::string versionFilePath = "";
|
||||
|
||||
#ifdef _WIN32
|
||||
wchar_t appDataPath[MAX_PATH] = {0};
|
||||
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
|
||||
char* path = new char[MAX_PATH];
|
||||
size_t pathLength;
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
|
||||
PWSTR pszPath = nullptr;
|
||||
char* path = new char[MAX_PATH]();
|
||||
size_t pathLength = 0;
|
||||
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
|
||||
if (SUCCEEDED(hr)) {
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
|
||||
std::string filePath = path;
|
||||
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
|
||||
|
||||
delete[] path;
|
||||
#elif __APPLE__
|
||||
const char* home_env = getenv("HOME");
|
||||
versionFilePath = home_env;
|
||||
@@ -115,13 +121,20 @@ namespace common
|
||||
std::string localArea = "";
|
||||
std::string cfgfile = "";
|
||||
#ifdef _WIN32
|
||||
wchar_t appDataPath[MAX_PATH] = {0};
|
||||
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
|
||||
char* path = new char[MAX_PATH];
|
||||
size_t pathLength;
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
|
||||
|
||||
PWSTR pszPath = nullptr;
|
||||
char* path = new char[MAX_PATH]();
|
||||
size_t pathLength = 0;
|
||||
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
|
||||
if (SUCCEEDED(hr)) {
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
|
||||
std::string filePath = path;
|
||||
cfgfile = filePath + "\\" + std::string("Snapmaker_Orca\\Snapmaker_Orca.conf");
|
||||
delete[] path;
|
||||
|
||||
#elif __APPLE__
|
||||
const char* home_env = getenv("HOME");
|
||||
cfgfile = home_env;
|
||||
@@ -150,13 +163,20 @@ namespace common
|
||||
|
||||
std::string cfgfile = "";
|
||||
#ifdef _WIN32
|
||||
wchar_t appDataPath[MAX_PATH] = {0};
|
||||
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
|
||||
char* path = new char[MAX_PATH];
|
||||
size_t pathLength;
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
|
||||
|
||||
PWSTR pszPath = nullptr;
|
||||
char* path = new char[MAX_PATH]();
|
||||
size_t pathLength = 0;
|
||||
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &pszPath);
|
||||
if (SUCCEEDED(hr)) {
|
||||
wcstombs_s(&pathLength, path, MAX_PATH, pszPath, MAX_PATH);
|
||||
CoTaskMemFree(pszPath);
|
||||
}
|
||||
|
||||
std::string filePath = path;
|
||||
cfgfile = filePath + "\\" + std::string("Snapmaker_Orca\\Snapmaker_Orca.conf");
|
||||
delete[] path;
|
||||
|
||||
#elif __APPLE__
|
||||
const char* home_env = getenv("HOME");
|
||||
cfgfile = home_env;
|
||||
|
||||
Reference in New Issue
Block a user