mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Improve on portable App and registry access
This commit is contained in:
parent
91faa1b675
commit
00fbb85c70
2
Makefile
2
Makefile
@ -141,7 +141,7 @@ xca$(SUFFIX).signed: xca$(SUFFIX)
|
||||
|
||||
setup.exe: setup_xca-$(VERSION).exe
|
||||
setup_xca-$(VERSION).exe: xca-8859-1.nsi xca-portable-$(VERSION)
|
||||
$(MAKENSIS) -DINSTALLDIR=xca-portable -DQTDIR=$(QTDIR) \
|
||||
$(MAKENSIS) -DINSTALLDIR=xca-portable-$(VERSION) -DQTDIR=$(QTDIR) \
|
||||
-DVERSION=$(VERSION) -DBDIR=$(BDIR) -DTOPDIR=$(TOPDIR)\
|
||||
-NOCD -V2 -DEXTRA_VERSION=${EXTRA_VERSION} $<
|
||||
if test -n "$(OSSLSIGN)"; then \
|
||||
|
||||
@ -71,7 +71,7 @@ int portable_app()
|
||||
#if defined(Q_OS_WIN32)
|
||||
HKEY hKey;
|
||||
portable = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\xca", 0,
|
||||
KEY_WOW64_64KEY|KEY_READ, &hKey) != ERROR_SUCCESS;
|
||||
KEY_WOW64_32KEY|KEY_READ, &hKey) != ERROR_SUCCESS;
|
||||
#else
|
||||
const char *p = getenv("XCA_PORTABLE");
|
||||
portable = p && *p;
|
||||
@ -109,7 +109,7 @@ QString getPrefix()
|
||||
p = inst_dir;
|
||||
*p = '\0';
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\xca", 0,
|
||||
KEY_WOW64_64KEY|KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
KEY_WOW64_32KEY|KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
{
|
||||
XCA_WARN("Registry Key: 'HKEY_LOCAL_MACHINE\\Software\\xca' not found");
|
||||
return QString(inst_dir);
|
||||
|
||||
@ -30,7 +30,7 @@ settings::settings()
|
||||
defaul["mandatory_dn"] = "";
|
||||
defaul["explicit_dn"] = "C,ST,L,O,OU,CN,emailAddress";
|
||||
defaul["string_opt"] = "MASK:0x2002";
|
||||
defaul["workingdir"] = QDir::currentPath();
|
||||
defaul["workingdir"] = QDir::toNativeSeparators(QDir::currentPath());
|
||||
defaul["default_hash"] = hashBox::getDefault();
|
||||
defaul["ical_expiry"] = "1W";
|
||||
defaul["cert_expiry"] = "80%";
|
||||
@ -72,9 +72,6 @@ void settings::setAction(const QString &key, const QString &value)
|
||||
}
|
||||
TransCommit();
|
||||
return;
|
||||
} else if (key == "workingdir") {
|
||||
if (!QFile::exists(value))
|
||||
return;
|
||||
}
|
||||
values[key] = value;
|
||||
}
|
||||
@ -113,7 +110,7 @@ void settings::set(QString key, QString value)
|
||||
load_settings();
|
||||
|
||||
if (key == "workingdir") {
|
||||
if (portable_app())
|
||||
if (portable_app() || !QDir(value).exists())
|
||||
return;
|
||||
value = QDir::toNativeSeparators(value);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user