Open nuttyartist opened 1 year ago
I see a "portable" download (Notes_2.1.0-Qt5.15.2-x64-Windows-Portable.zip) but that still seems to store the database in %APPDATA%\Awesomeness
- is there a special flag / method to let it read the settings & database from the application folder? e.g. notes.exe --portable
or notes.exe path-to\notes.db
I see a setting for the path, but that seems a hard coded path while relative should be better for portable use
Some portable apps simply look for a text file in the current folder, something as simple as portable.txt
(can be empty) or portable.ini
if you want to use it to store settings.
Hi! Currently, we don't support this, but when we'll, you'll hear about it here.
I also would love to see a fully portable version, where settings and database are stored in a relative-path manner, in the same folder where the . exe resides. Thanks for this great program. It has a lot of potential.
I wonder if we can easily give QSettings
the path of the executable dir to make this work. Maybe that is the right constructor https://doc.qt.io/qt-6/qsettings.html#QSettings-3? Need some testing.
Thanks, @Stefanoko, I'll keep you posted here for changes.
EDIT: Seems like it's pretty easy using QSettings::setPath
https://doc.qt.io/qt-6/qsettings.html#setPath.
It's not exactly what folks here are asking for but we released Notes Portable at PortableApps.com. It includes the 64-bit Qt6 and (optionally) 32-bit Qt5 variants and will automatically use the right one on each PC. Your notes.db will remain within the app on your portable device. Settings will be moved to and from APPDATA\Awesomeness, backing up and restoring any existing files, and adjusting the paths so that your notes.db is pointed to as the paths change.
Hey @JohnTHaller , that's awesome. Care to send a PR? It will be great to have a CMAKE flag for this, if possible, then we'll just add it to our CI. @guihkx, what do you think?
Hey @JohnTHaller , that's awesome. Care to send a PR? It will be great to have a CMAKE flag for this, if possible, then we'll just add it to our CI. @guihkx, what do you think?
Notes itself is entirely unchanged. The NotesPortable.exe launcher handles moving the files around and adjusting paths. It's done with a simple config file:
[Launch] ProgramExecutable=Notes32\Notes.exe ProgramExecutable64=Notes\Notes.exe WorkingDirectory=%FullAppDir% DirectoryMoveOK=yes SupportsUNC=yes MinOS=7
[DirectoriesMove] NotesConfig=%APPDATA%\Awesomeness`
[FileWrite1] Type=Replace File=%PAL:DataDir%\NotesConfig\Settings.ini Find=%PAL:LastDrive%%PAL:LastPackagePartialDir:ForwardSlash%/ Replace=%PAL:Drive%%PAL:PackagePartialDir:ForwardSlash%/
[FileWrite2] Type=Replace File=%PAL:DataDir%\NotesConfig\Settings.ini Find=%PAL:LastDrive%%PAL:LastPortableAppsBaseDir:ForwardSlash%/ Replace=%PAL:Drive%%PAL:PortableAppsBaseDir:ForwardSlash%/
[FileWrite3] Type=Replace File=%PAL:DataDir%\NotesConfig\Settings.ini Find=%PAL:LastDrive%/ Replace=%PAL:Drive%/
[FileWrite4] Type=Replace File=%PAL:DataDir%\NotesConfig\Settings.ini Find=@PLACEHOLDER_DEFAULTNOTEFILE@ Replace=%PAL:DataDir:ForwardSlash%/NotesDB/notes.db
And a bit of custom code to force Windows 7/8 to run the 32-bit Qt5 version:
Var CustomBits
${SegmentFile}
${Segment.OnInit} System::Call kernel32::GetCurrentProcess()i.s System::Call kernel32::IsWow64Process(is,*i.r0) ReadRegStr $1 HKLM "Software\Microsoft\Windows NT\CurrentVersion" "CurrentBuild"
${If} $0 == 0
${OrIf} $1 < 10000 ;Earlier than Win10
StrCpy $CustomBits 32
${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Notes32"
${Else}
StrCpy $CustomBits 64
${SetEnvironmentVariablesPath} FullAppDir "$EXEDIR\App\Notes"
${EndIf}
StrCpy $Bits $CustomBits
!macroend
${SegmentInit} ${If} $CustomBits != "" StrCpy $Bits $CustomBits ${EndIf} !macroend
Happy to have you distribute as well or instead of us and us linking to your builds. Or somewhere in between (we do all variants for various devs).
On a related note: Currently linking to your Patreon for the Donation link in help.html, within the app for the PA.c Plaftform to pick up, and from the portable app's homepage. Have you thought about having a single /donation page on get-notes.com that links to everything? That would make it so we don't have to pick just one.
Oh that's great, thanks for sharing. I'll wait for @guihkx reply about integrating it to our build process. Regarding donations, I just created a page here: https://www.get-notes.com/donation. Thanks for letting me know!
Cool. Switched the portable app homepage to the new link (cache will update shortly). Will have it included in the next package as well.
Thank you @JohnTHaller, I've used a lot of apps from your website back in my Windows days. :)
Though I'm a bit confused here, @nuttyartist: Do we actually need to do something else on our part? It seems like the build on PortableApps.com works independently from us.
@guihkx - If you're happy with us building and hosting, you're good. You can link to us for the builds and/or add them on to your releases here on github if you'd like.
I'd be fine with that, though @nuttyartist has the last word on it.
But in my opinion, this issue needs to be solved on our side, maybe via a build flag that'd allow us to control, at build time, the portability of the settings and notes database...
Or, maybe even better: At runtime. By simply by asking users if they prefer to keep the settings and the notes database stored in the same directory as the main executable...
I think, ideally, you'll want to support it internally within your code base. We can make use of that for our package as we do with many projects. But you could point to or distribute our Notes Portable package in the meantime.
As for how to expose it, many projects detect the settings in the same folder. So you'd look for Settings.ini alongside Notes.exe and use that. Hopefully also storing the path to the database relatively within Settings.ini. Or by having a trigger directory like Settings or similar in the same place.
But in my opinion, this issue needs to be solved on our side, maybe via a build flag that'd allow us to control, at build time, the portability of the settings and notes database...
My thoughts as well. I prefer if the entire build process of the binaries our users use (wherever they download it from) will go through a transparent build process by us. We just saw what happened with xz.
Both a runtime toggle or a separate binary sounds good to me.
Some people asked if there are portable versions of Notes for Windows (there are) that can save the database and settings file in the same directory the app is running from. They said "It makes it a valuable tool to have on a USB key, without worrying about User system or leaving traces".