mirror of https://github.com/buggins/dlangui.git
commit
20be42432e
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue