diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-06-14 20:15:37 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-06-14 20:22:03 +0300 |
commit | bcff0ef9cabc37c4b89a1e2c7972a09ac80d4555 (patch) | |
tree | 06c0f6e881018b578197ddbcfe671c70318cf852 /source/blender/blenlib/intern | |
parent | 2e5671a959182dadcdd55117732082ab7893f3d1 (diff) |
UI: Windows Blend File Association
This patch allows Windows users to specify that their current blender
installation should be used to create thumbnails and be associated
with ".blend" files. This is done from Preferences / System. The only
way to do this currently is from the command-line and this is sometimes
inconvenient.
Differential Revision: https://developer.blender.org/D10887
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 3aa61d1fec5..d40f665ba0d 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -67,10 +67,9 @@ static void register_blend_extension_failed(HKEY root, const bool background) if (!background) { MessageBox(0, "Could not register file extension.", "Blender error", MB_OK | MB_ICONERROR); } - TerminateProcess(GetCurrentProcess(), 1); } -void BLI_windows_register_blend_extension(const bool background) +bool BLI_windows_register_blend_extension(const bool background) { LONG lresult; HKEY hkey = 0; @@ -107,6 +106,7 @@ void BLI_windows_register_blend_extension(const bool background) lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root); if (lresult != ERROR_SUCCESS) { register_blend_extension_failed(0, background); + return false; } } @@ -119,6 +119,7 @@ void BLI_windows_register_blend_extension(const bool background) } if (lresult != ERROR_SUCCESS) { register_blend_extension_failed(root, background); + return false; } lresult = RegCreateKeyEx(root, @@ -137,6 +138,7 @@ void BLI_windows_register_blend_extension(const bool background) } if (lresult != ERROR_SUCCESS) { register_blend_extension_failed(root, background); + return false; } lresult = RegCreateKeyEx(root, @@ -155,6 +157,7 @@ void BLI_windows_register_blend_extension(const bool background) } if (lresult != ERROR_SUCCESS) { register_blend_extension_failed(root, background); + return false; } lresult = RegCreateKeyEx( @@ -166,6 +169,7 @@ void BLI_windows_register_blend_extension(const bool background) } if (lresult != ERROR_SUCCESS) { register_blend_extension_failed(root, background); + return false; } BLI_windows_get_executable_dir(InstallDir); @@ -184,7 +188,7 @@ void BLI_windows_register_blend_extension(const bool background) "all users"); MessageBox(0, MBox, "Blender", MB_OK | MB_ICONINFORMATION); } - TerminateProcess(GetCurrentProcess(), 0); + return true; } void BLI_windows_get_default_root_dir(char *root) |