WebView: Correctly define the cache path.

[GB.QT4.WEBKIT]
* BUG: WebView: Correctly define the cache path.

[GB.QT5.WEBKIT]
* BUG: WebView: Correctly define the cache path.
This commit is contained in:
gambas 2018-09-25 13:57:07 +02:00
parent 6619f59263
commit 1f63103731

View file

@ -192,19 +192,21 @@ BEGIN_PROPERTY(WebSettingsCache_Path)
GB.ReturnString(_cache_path); GB.ReturnString(_cache_path);
else else
{ {
QString path = QString(GB.FileName(PSTRING(), PLENGTH())); char *path = GB.FileName(PSTRING(), PLENGTH());
QString qpath = QString(path);
QString root = QString(GB.System.Home()); QString root = QString(GB.System.Home());
if (root.at(root.length() - 1) != '/') if (root.at(root.length() - 1) != '/')
root += '/'; root += '/';
root += ".cache/"; root += ".cache/";
if (!path.startsWith(root)) if (!qpath.startsWith(root))
{ {
GB.Error("Cache directory must be located inside ~/.cache"); GB.Error("Cache directory must be located inside ~/.cache");
return; return;
} }
GB.StoreString(PROP(GB_STRING), &_cache_path); GB.FreeString(&_cache_path);
_cache_path = GB.NewZeroString(path);
set_cache(_cache_enabled); set_cache(_cache_enabled);
} }