Merge pull request #131 from g4z3r/master

fix
This commit is contained in:
Vadim Lopatin 2015-12-22 06:27:18 +03:00
commit 20be42432e
1 changed files with 4 additions and 4 deletions

View File

@ -257,8 +257,8 @@ bool isPathDelimiter(char ch) {
/** Returns current executable path only, including last path delimiter - removes executable name from result of std.file.thisExePath() */ /** Returns current executable path only, including last path delimiter - removes executable name from result of std.file.thisExePath() */
@property string exePath() { @property string exePath() {
string path = thisExePath(); string path = thisExePath();
ulong lastSlash = 0; int lastSlash = 0;
foreach(i; 0 .. path.length) for (int i = 0; i < path.length; i++)
if (path[i] == PATH_DELIMITER) if (path[i] == PATH_DELIMITER)
lastSlash = i; lastSlash = i;
return path[0 .. lastSlash + 1]; return path[0 .. lastSlash + 1];
@ -346,8 +346,8 @@ char[] appendPath(char[] buf, string[] pathItems ...) {
/** Split path into elements, e.g. /home/user/dir1 -> ["home", "user", "dir1"], "c:\dir1\dir2" -> ["c:", "dir1", "dir2"] */ /** Split path into elements, e.g. /home/user/dir1 -> ["home", "user", "dir1"], "c:\dir1\dir2" -> ["c:", "dir1", "dir2"] */
string[] splitPath(string path) { string[] splitPath(string path) {
string[] res; string[] res;
ulong start = 0; int start = 0;
foreach(i; 0 .. path.length + 1) { for (int i = 0; i <= path.length; i++) {
char ch = i < path.length ? path[i] : 0; char ch = i < path.length ? path[i] : 0;
if (ch == '\\' || ch == '/' || ch == 0) { if (ch == '\\' || ch == '/' || ch == 0) {
if (start < i) if (start < i)