abricotine icon indicating copy to clipboard operation
abricotine copied to clipboard

Creating new files from command line

Open jacobmischka opened this issue 8 years ago • 4 comments

While abricotine works great when trying to open an existing file from the command line, it does not like trying to create one that doesn't already exist. It would be really great if running abricotine test.md would create test.md if it can't open it.

$ abricotine notes/hm.md
{ Error: ENOENT: no such file or directory, stat 'notes/hm.md'
    at Error (native)
    at fs.statSync (fs.js:992:18)
    at Object.fs.statSync (ELECTRON_ASAR.js:280:16)
    at Object.isTextFile (/opt/abricotine/resources/app.asar/app/files.js:134:31)
    at /opt/abricotine/resources/app.asar/app/abr-application.js:101:66
    at Array.filter (native)
    at Object.run (/opt/abricotine/resources/app.asar/app/abr-application.js:100:29)
    at Object.AbrApplication (/opt/abricotine/resources/app.asar/app/abr-application.js:24:10)
    at /opt/abricotine/resources/app.asar/app/index.js:73:22
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'notes/hm.md' }

Thanks! I'm really liking using Abricotine to take notes in markdown, this is a great markdown editor.

jacobmischka avatar Dec 03 '16 08:12 jacobmischka

Great suggestion. It should also display better error messages.

darahak avatar Dec 04 '16 00:12 darahak

Not the ideal location to put this, but I couldn't find a better one:

On Windows, starting an existing file requires a bit more work, at least to make it robust w.r.t. version updates. The Abricotine shortcut on Windows actually calls the updater, which in turn starts Abricotine. This is probably done to check for updates at startup, and to be robust to version changes, as Abricotine.exe seems to be located in a directory with a version number in its name. E.g., in my case, app-0.4.0/Abricotine.exe.

If you want to open a specific file when starting Abricotine, (copy and) append the following to the 'target' field of the existing Abricotine start menu shortcut:

--process-start-args "/path/to/file.md"

For example, the resulting shortcut target could be:

C:\Users\<user>\AppData\Local\Abricotine\Update.exe --processStart "Abricotine.exe" --process-start-args "C:\Users\<user>\Documents\file.md"

This took me some time to figure out, and might be useful to others.

tjallingran avatar Jan 23 '17 15:01 tjallingran

@tjallingran This is because Abricotine installer is created with Squirrel.Windows. Thank you for the trick which I didn't know, though. I'll update the documentation... or maybe directly update to the latest version of Squirrel which is obviously not using Update.exe anymore: #152.

brrd avatar Jan 23 '17 16:01 brrd

@brrd Yeah, maybe I should have mentioned that I found the --process-start-args flag in the Squirrel code, here. So I thought as much, although I'm totally not familiar with Squirrel and didn't realize that it is not used in the Linux version of Abricotine.

Their decision to change from using Update.exe to a "dummy" executable (#152) definitely seems like a good choice.

tjallingran avatar Jan 23 '17 16:01 tjallingran