mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-15 14:34:50 -04:00
fix file picker default path crash when it’s not a file extension
This commit is contained in:
parent
683b603d68
commit
c95d09512e
1 changed files with 5 additions and 1 deletions
|
@ -105,10 +105,14 @@ GEODE_DLL Task<Result<std::filesystem::path>> file::pick(file::PickMode mode, fi
|
|||
}
|
||||
|
||||
NSURL *FileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.file"]];
|
||||
if (options.defaultPath) {
|
||||
if (options.defaultPath && !options.defaultPath->parent_path().empty()) {
|
||||
FileURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:options.defaultPath->c_str()]];
|
||||
}
|
||||
else if (options.defaultPath) {
|
||||
auto FileExtension = [NSString stringWithUTF8String:options.defaultPath->c_str()];
|
||||
FileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:FileExtension]];
|
||||
}
|
||||
|
||||
// just for the picker not to crash, it gotta have a file to "save" then the writing is handled in the mod once we save the file somewhere
|
||||
[@"" writeToURL:FileURL atomically:NO encoding:NSUTF8StringEncoding error:nil];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue