Skip to content

Commit

Permalink
Path to log files is now created
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan "TheSHEEEP" Drabner committed May 14, 2016
1 parent 5685bea commit c7aa288
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions easylog/InternalLogger.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package easylog;
#if (cpp || neko || php)
import sys.io.File;
import sys.io.FileOutput;
import sys.FileSystem;
#end
import haxe.PosInfos;

Expand Down Expand Up @@ -38,6 +39,15 @@ class InternalLogger
#if (cpp || neko || php)
if (p_filePath != "")
{
// Make sure that the path exists
if (p_filePath.indexOf("/") != -1)
{
var lastIndex : Int = p_filePath.lastIndexOf("/");
var path : String = p_filePath.substr(0, lastIndex);
FileSystem.createDirectory(path);
}

// Open the file
_file = p_append ? File.append(p_filePath, false) : File.write(p_filePath, false);
}
#end
Expand Down
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"license": "MIT",
"tags": ["logging","logs","log","debug","easylog","files"],
"description": "Easy to use logging tool that allows different logging levels as well as logging to different files.",
"version": "1.0.0",
"version": "1.0.1",
"classpath": "/",
"releasenote": "First release - already very usable, though.",
"releasenote": "1.0.1 - the path to the log file(s) is now created before trying to open the file.",
"contributors": ["TheSHEEEP"],
"dependencies": {
}
Expand Down

0 comments on commit c7aa288

Please sign in to comment.