-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: don't directly call the win32 open/savedialog impls.
instead call them through a "cross-platform" wrapper.
- Loading branch information
1 parent
024c82e
commit e2039b3
Showing
4 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace VTTiny.Editor.Native | ||
{ | ||
/// <summary> | ||
/// This is the multiplatform wrapper for the open/save file dialog functionality. | ||
/// It just calls back into the platform-specific implementations. | ||
/// | ||
/// NOTE: So far the only FileDialog implementation we have is for Win32. | ||
/// PRs to improve that are welcome. | ||
/// </summary> | ||
public static class FileDialog | ||
{ | ||
/// <summary> | ||
/// Show an open file dialog. | ||
/// </summary> | ||
/// <returns>The path to the opened file, or nothing.</returns> | ||
public static string OpenFile() | ||
{ | ||
#if ARCH_WINDOWS | ||
return Win32.FileDialog.OpenFile(); | ||
#else | ||
throw new System.NotImplementedException($"OpenFile() is not yet supported on {System.Runtime.InteropServices.RuntimeInformation.OSDescription}!"); | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Show a save file dialog. | ||
/// </summary> | ||
/// <returns>The path to the saved file, or nothing.</returns> | ||
public static string SaveFile() | ||
{ | ||
#if ARCH_WINDOWS | ||
return Win32.FileDialog.SaveFile(); | ||
#else | ||
throw new System.NotImplementedException($"SaveFile() is not yet supported on {System.Runtime.InteropServices.RuntimeInformation.OSDescription}!"); | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters