SpencerCDixon / exocortex

Open source, language independent, modern personal wiki
237 stars 20 forks source link

Windows paths are not escaped correctly #11

Open trytriangles opened 6 years ago

trytriangles commented 6 years ago

Windows paths use \ as the separator. When Exocortex writes its config file, it doesn't properly escape those slashes, meaning that when the config gets parsed each separator is interpreted as an attempt at writing an escape character, which always results in a fatal error.

C:\Users\Ryan > exo new test
   • Creating your new wiki: test
   • Successfully created your wiki: cd C:\Users\Ryan\test && exo start

C:\Users\Ryan > cd test && exo start
    ⨯ exo: Config file required to start wiki: While parsing config: invalid character 'U' in string escape code
SpencerCDixon commented 6 years ago

Whoops! Thanks for filing, I'll get a fix in soon

SpencerCDixon commented 6 years ago

Hmmm seems like I'm using filepath.Join in most places... @ryantriangles is it just failing to create the exocortex.json file in your test dir? If it did create one can you paste me the contents?

kempjeng commented 6 years ago

I have the same issue, no problems creating the exocortext.json file. Exact same error message.

Exo starts if I edit the json file to escape the paths manually.

SpencerCDixon commented 6 years ago

Could either of you paste me your .json file? So sounds like it's the repository field that is incorrect?

trytriangles commented 6 years ago

It successfully creates one, it's just writing a Windows path as-is. The error is helpfully highlighted by GitHub's JSON highlighting.

{
  "server": {
    "host": "localhost",
    "port": 1234
  },
  "repository": "D:\temp\hello",
  "syncInterval": 30,
  "title": "My Wiki",
  "remote": "origin",
  "branch": "master"
}
shonlove commented 5 years ago

18 is intended to fix this issue.