Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Creating new files from command line #135

Open
jacobmischka opened this issue Dec 3, 2016 · 4 comments
Open

Creating new files from command line #135

jacobmischka opened this issue Dec 3, 2016 · 4 comments

Comments

@jacobmischka
Copy link
Contributor

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.

@darahak
Copy link
Contributor

darahak commented Dec 4, 2016

Great suggestion.
It should also display better error messages.

@tjallingran
Copy link

tjallingran commented Jan 23, 2017

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.

@brrd
Copy link
Owner

brrd commented Jan 23, 2017

@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.

@tjallingran
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants