鏡像自
https://github.com/arsenetar/dupeguru-cocoa.git
synced 2025-07-12 01:53:20 +00:00
- Remove changes in main.m, turns out we cannot actually catch it here. Tried some other methods, however none worked. - Change dupeguru submodule to a more "known" commit that did not have partial work in it. NOTE: Issue with picture mode appears to be from python 3.8+ changing to use `spawn` as the method for multiprocessing. While this is most likely better we currently have issues when application is run normally (running from run.py does not have issues). I am manually going to change to `fork` instead since other methods did not work. This needs to be done on line 20 of matchblock.py. Either need to find a workaround or make a way to detect we are running with cocoa vs. qt to make this switch. Just on macos would affect qt build which does not need this change.
39 行
1.3 KiB
Objective-C
39 行
1.3 KiB
Objective-C
/*
|
|
Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
|
|
|
This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
|
which should be included with this package. The terms are also available at
|
|
http://www.gnu.org/licenses/gpl-3.0.html
|
|
*/
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import <Python.h>
|
|
#import <wchar.h>
|
|
#import <locale.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
/* We have to set the locate to UTF8 for mbstowcs() to correctly convert non-ascii chars in paths */
|
|
setlocale(LC_ALL, "en_US.UTF-8");
|
|
NSString *respath = [[NSBundle mainBundle] resourcePath];
|
|
NSString *mainpy = [respath stringByAppendingPathComponent:@"dg_cocoa.py"];
|
|
wchar_t wPythonPath[PATH_MAX+1];
|
|
NSString *pypath = [respath stringByAppendingPathComponent:@"py"];
|
|
mbstowcs(wPythonPath, [pypath fileSystemRepresentation], PATH_MAX+1);
|
|
Py_SetPath(wPythonPath);
|
|
Py_SetPythonHome(wPythonPath);
|
|
Py_Initialize();
|
|
PyGILState_STATE gilState = PyGILState_Ensure();
|
|
FILE* fp = fopen([mainpy UTF8String], "r");
|
|
PyRun_SimpleFile(fp, [mainpy UTF8String]);
|
|
fclose(fp);
|
|
PyGILState_Release(gilState);
|
|
if (gilState == PyGILState_LOCKED) {
|
|
PyThreadState_Swap(NULL);
|
|
PyEval_ReleaseLock();
|
|
}
|
|
int result = NSApplicationMain(argc, (const char **) argv);
|
|
Py_Finalize();
|
|
return result;
|
|
}
|