Merge branch 'dev' of http://192.168.10.5:8099/sane/code_app into dev
This commit is contained in:
commit
00ae7dbda2
|
@ -414,7 +414,29 @@ HGResult HGAPI HGBase_GetDocumentsPath(HGChar* documentsPath, HGUInt maxLen)
|
||||||
strcpy(docPath, pw->pw_dir);
|
strcpy(docPath, pw->pw_dir);
|
||||||
if (docPath[strlen(docPath) - 1] != '/')
|
if (docPath[strlen(docPath) - 1] != '/')
|
||||||
strcat(docPath, "/");
|
strcat(docPath, "/");
|
||||||
strcat(docPath, "Documents/");
|
std::string docName;
|
||||||
|
FILE* file = popen("cat $HOME/.config/user-dirs.dirs | grep DOCUMENTS | tail -1 | cut -d '=' -f 2 | sed 's/\"//g'", "r");
|
||||||
|
if (NULL != file)
|
||||||
|
{
|
||||||
|
char data[1024] = { 0 };
|
||||||
|
if (NULL != fgets(data, 1024, file))
|
||||||
|
{
|
||||||
|
char* start = strchr(data, '/');
|
||||||
|
if (NULL != start && 0 != *(start + 1))
|
||||||
|
{
|
||||||
|
char* end = strchr(start + 1, '\n');
|
||||||
|
if (NULL != end)
|
||||||
|
*end = 0;
|
||||||
|
docName = start + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(file);
|
||||||
|
}
|
||||||
|
if (docName.empty())
|
||||||
|
docName = "Documents";
|
||||||
|
strcat(docPath, docName.c_str());
|
||||||
|
strcat(docPath, "/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (maxLen < strlen(docPath) + 1)
|
if (maxLen < strlen(docPath) + 1)
|
||||||
|
|
Loading…
Reference in New Issue