little-brother / sqlite-gui

Lightweight SQLite editor for Windows
GNU General Public License v2.0
1.09k stars 52 forks source link

Add -profile <PATH> command line argument #142

Closed tnodir closed 1 year ago

tnodir commented 1 year ago

Please add ability to change the path, where the prefs.sqlite should be stored.

Rationale:

  1. I work as non-admin, so I've no rights to write to app's folder.
  2. I can create the prefs.sqlite file in app's folder and grant write rights to ordinary user, but there is still problem with temporary prefs.sqlite-journal file.
ghost commented 1 year ago

good issue. looks like currently it just assumes that it is in the same folder as the program:

https://github.com/little-brother/sqlite-gui/blob/1124f3b52a9aa6dc7381ba95c81ad7b4ef92f01e/src/main.cpp#L158-L161

little-brother commented 1 year ago

--profile and --readonly were added. -p is skipped. csv-import and csv-export CLI options were changed to --csv-import and --csv-export.

tnodir commented 1 year ago

@little-brother Thanks for adding the "--profile" argument.

Now it expects a file path: --profile <PATH>\prefs.sqlite

Can you please change it to expect just a path: --profile <PATH> ?

WinMain():

    if (profileArgNo && profileArgNo < nArgs) {
        _tcscpy(prefPath16, args[profileArgNo + 1]);
    } else {
        _tcscpy(prefPath16, APP_PATH);
-       _tcscat(prefPath16, TEXT("\\prefs.sqlite"));
    }
+   _tcscat(prefPath16, TEXT("\\prefs.sqlite"));
little-brother commented 1 year ago

It already should be --profile <PATH> because _tcscpy(prefPath16, args[profileArgNo + 1]);.

tnodir commented 1 year ago

I've first tried the following: D:\Utils\Tools\SQLiteGui\sqlite-gui.exe --profile D:\Utils\Tools\SQLiteGui\data , but it did not work.

Then I saw the source code and used the: D:\Utils\Tools\SQLiteGui\sqlite-gui.exe --profile D:\Utils\Tools\SQLiteGui\data\prefs.sqlite , which did work.