UserNotes: Check current directory for portable database file
@@ -273,7 +273,9 @@ VOID NTAPI LoadCallback(
_In_opt_ PVOID Context
)
{
+ static PH_STRINGREF databaseFile = PH_STRINGREF_INIT(L"usernotesdb.xml");
PPH_PLUGIN toolStatusPlugin;
+ PPH_STRING directory;
PPH_STRING path;
if (toolStatusPlugin = PhFindPlugin(TOOLSTATUS_PLUGIN_NAME))
@@ -284,21 +286,29 @@ VOID NTAPI LoadCallback(
ToolStatusInterface = NULL;
}
+ directory = PH_AUTO(PhGetApplicationDirectory());
+ path = PH_AUTO(PhConcatStringRef2(&directory->sr, &databaseFile));
+
+ if (RtlDoesFileExists_U(path->Buffer))
+ {
+ SetDbPath(path);
+ }
+ else
+ {
path = PhaGetStringSetting(SETTING_NAME_DATABASE_PATH);
path = PH_AUTO(PhExpandEnvironmentStrings(&path->sr));
- LoadCustomColors();
-
if (RtlDetermineDosPathNameType_U(path->Buffer) == RtlPathTypeRelative)
{
- PPH_STRING directory;
-
directory = PH_AUTO(PhGetApplicationDirectory());
path = PH_AUTO(PhConcatStringRef2(&directory->sr, &path->sr));
}
SetDbPath(path);
+ }
+
LoadDb();
+ LoadCustomColors();
}
VOID NTAPI UnloadCallback(
