Skip to content

Commit

Permalink
Workaround for windows service execution (#537)
Browse files Browse the repository at this point in the history
IB-7759

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Jun 27, 2023
1 parent 0c0537d commit aad9c4e
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/util/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ string File::digidocppPath()
{
#ifdef _WIN32
PWSTR knownFolder {};
if(SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_CREATE, nullptr, &knownFolder) != S_OK)
if(SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DONT_VERIFY, nullptr, &knownFolder) != S_OK)
THROW("Failed to get home directory");
string appData = (fs::path(knownFolder) / "digidocpp").u8string();
CoTaskMemFree(knownFolder);
Expand All @@ -338,26 +338,6 @@ string File::digidocppPath()
#endif
}

/**
* Returns true if the path is relative
*
* @return returns true if the path is relative
*/
bool File::isRelative(const string &path)
{
f_string _path = encodeName(path);
if(_path.empty()) return true;
if(_path[0] == '/') return false;
#ifdef _WIN32
// drive, e.g. "a:", or UNC root, e.q. "//"
if( _path.length() >= 2 &&
((iswalpha(_path[0]) && _path[1] == ':') ||
(_path[0] == '/' && _path[1] == '/')) )
return false;
#endif
return true;
}

/**
* Constructs the full file path in the format "file:///fullpath" in URI encoding.
*
Expand Down

0 comments on commit aad9c4e

Please sign in to comment.