Ability to define cartridge directory TIC-80 standalone uses #175
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/fs.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/fs.c
									
									
									
									
									
								
							@@ -558,6 +558,8 @@ const char* fsFullname(const char *path)
 | 
				
			|||||||
	result = StringToUTF8(wpath);
 | 
						result = StringToUTF8(wpath);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						result = realpath(path, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
@@ -568,6 +570,11 @@ const char* fsBasename(const char *path)
 | 
				
			|||||||
	char* result = NULL;
 | 
						char* result = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__WINDOWS__) || defined(__WINRT__)
 | 
					#if defined(__WINDOWS__) || defined(__WINRT__)
 | 
				
			||||||
 | 
					#define SEP "\\"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define SEP "/"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		char* full = (char*)fsFullname(path);
 | 
							char* full = (char*)fsFullname(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -582,7 +589,7 @@ const char* fsBasename(const char *path)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				while(ptr >= result)
 | 
									while(ptr >= result)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if(*ptr == '\\')
 | 
										if(*ptr == SEP[0])
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						result[ptr-result] = '\0';
 | 
											result[ptr-result] = '\0';
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
@@ -594,12 +601,8 @@ const char* fsBasename(const char *path)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(result && result[strlen(result)-1] != '\\')
 | 
						if(result && result[strlen(result)-1] != SEP[0])
 | 
				
			||||||
		strcat(result, "\\");
 | 
							strcat(result, SEP);
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user