python home set at windows os,fix path string encoding

This commit is contained in:
dreamsourcelabTAI 2021-12-13 11:56:25 +08:00
parent a16b97cf90
commit dd11e1096c
4 changed files with 9 additions and 6 deletions

View File

@ -77,19 +77,22 @@ bool AppControl::Init()
QString resdir = GetResourceDir();
sr_set_firmware_resource_dir(resdir.toUtf8().data());
#ifdef _WIN32
QString pythonHome = GetAppDataDir() + "/Python";
QDir pydir;
if (pydir.exists(pythonHome)){
srd_set_python_home(pythonHome.toUtf8().data());
const wchar_t *pyhome = reinterpret_cast<const wchar_t*>(pythonHome.utf16());
srd_set_python_home(pyhome);
}else{
qDebug()<<"python home directory not exists,"<<pythonHome;
}
#endif
QString dir = GetAppDataDir() + "/decoders";
char path[256] = {0};
QString dir = GetAppDataDir() + "/decoders";
strcpy(path, dir.toUtf8().data());
// Initialise libsigrokdecode

View File

@ -361,7 +361,7 @@ struct srd_pd_callback {
SRD_API int srd_init(const char *path);
SRD_API int srd_exit(void);
SRD_API GSList *srd_searchpaths_get(void);
SRD_API void srd_set_python_home(const char *path);
SRD_API void srd_set_python_home(const wchar_t *path);
/* session.c */
SRD_API int srd_session_new(struct srd_session **sess);

View File

@ -387,7 +387,7 @@ SRD_API GSList *srd_searchpaths_get(void)
}
//set python home directory
SRD_API void srd_set_python_home(const char *path)
SRD_API void srd_set_python_home(const wchar_t *path)
{
Py_SetPythonHome((wchar_t*)path);
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2021-12-10T18:13:59. -->
<!-- Written by QtCreator 4.11.0, 2021-12-13T10:43:31. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -93,7 +93,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>