Skip to content

Commit

Permalink
* Create the user data directory at startup if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
chippydip committed Oct 15, 2013
1 parent 8f224fe commit 76b79fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Hearth Log/HearthLogApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ std::ofstream fout;

bool HearthLogApp::OnInit()
{
// Open a file for logging
// Build the path for a log file
auto file = Helper::GetUserDataDir();
file.SetFullName("log.txt");

// Create the containing directory if needed
if (!file.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL)) {
wxLogError("error creating save directory: %s", file.GetPath());
return false;
}

// Open a file for logging
fout.open(file.GetFullPath().c_str().AsChar(), std::ofstream::out);

// Setup the log file
Expand Down
2 changes: 1 addition & 1 deletion Hearth Log/Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

const std::string &Helper::AppVersion()
{
static const std::string version = "v0.2";
static const std::string version = "v0.2.1";
return version;
}

Expand Down

0 comments on commit 76b79fc

Please sign in to comment.