Skip to content

Commit

Permalink
fix logger path in windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Sep 17, 2021
1 parent d6492e4 commit fb19d6f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion BuildTools/windows/installer/64bit/GeoDa-win7+.iss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"

[dirs]
Name: "{app}"; Permissions: users-modify; Check: InitializeSetup
Name: "{app}"; Check: InitializeSetup
Name: "{userappdata}\GeoDa\basemap_cache"; Permissions: users-modify
Name: "{userappdata}\GeoDa\lang"; Permissions: users-modify

Expand Down
3 changes: 1 addition & 2 deletions DialogTools/ReportBugDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ bool ReportBugDlg::CreateIssue(wxString title, wxString body)
{
body.Replace("\n", "\\n");
// get log file to body
wxString logger_path;
logger_path << GenUtils::GetSamplesDir() << "logger.txt";
wxString logger_path = GenUtils::GetLoggerPath();

body << "\\n";

Expand Down
13 changes: 11 additions & 2 deletions GenUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,16 +2357,25 @@ wxString GenUtils::GetSamplesDir()
{
#ifdef __WXOSX__
return GetResourceDir();
#elif __linux__
#else
return GetWebPluginsDir();
#endif
}

wxString GenUtils::GetLoggerPath()
{
#ifdef __WXOSX__
return GetResourceDir() + "logger.txt";
#elif __linux__
return GetWebPluginsDir() + "logger.txt";
#else
wxString confDir = wxStandardPaths::Get().GetUserConfigDir();
// Windows: AppData\Roaming\GeoDa
wxString geodaUserDir = confDir + wxFileName::GetPathSeparator() + "GeoDa";
if (wxDirExists(geodaUserDir) == false) {
wxFileName::Mkdir(geodaUserDir);
}
return geodaUserDir;
return geodaUserDir + wxFileName::GetPathSeparator() + "logger.txt";
#endif
}

Expand Down
1 change: 1 addition & 0 deletions GenUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ namespace GenUtils {
wxString GetBasemapDir();
wxString GetCachePath();
wxString GetLangSearchPath();
wxString GetLoggerPath();

bool less_vectors(const vector<int>& a,const vector<int>& b);
bool smaller_pair(const std::pair<int, int>& a,
Expand Down
2 changes: 1 addition & 1 deletion GeoDa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ bool GdaApp::OnInit(void)
welcome_pos.y += 150;

// Setup new Logger after crash check
wxString loggerFile = GenUtils::GetSamplesDir() +"logger.txt";
wxString loggerFile = GenUtils::GetLoggerPath();

if (m_pLogFile == NULL) {
#ifdef __WIN32__
Expand Down

0 comments on commit fb19d6f

Please sign in to comment.