Ability to define cartridge directory TIC-80 standalone uses #175

This commit is contained in:
tic 2017-11-19 23:49:42 +03:00
parent ad25e01c60
commit 7e99842d73
1 changed files with 10 additions and 7 deletions

View File

@ -558,6 +558,8 @@ const char* fsFullname(const char *path)
result = StringToUTF8(wpath);
#else
result = realpath(path, NULL);
#endif
return result;
@ -568,6 +570,11 @@ const char* fsBasename(const char *path)
char* result = NULL;
#if defined(__WINDOWS__) || defined(__WINRT__)
#define SEP "\\"
#else
#define SEP "/"
#endif
{
char* full = (char*)fsFullname(path);
@ -582,7 +589,7 @@ const char* fsBasename(const char *path)
while(ptr >= result)
{
if(*ptr == '\\')
if(*ptr == SEP[0])
{
result[ptr-result] = '\0';
break;
@ -594,12 +601,8 @@ const char* fsBasename(const char *path)
}
}
if(result && result[strlen(result)-1] != '\\')
strcat(result, "\\");
#else
#endif
if(result && result[strlen(result)-1] != SEP[0])
strcat(result, SEP);
return result;
}