pawandubey / griffin

speedy and simplistic static site generator.
Apache License 2.0
27 stars 7 forks source link

Generate new project failed on Windows #37

Closed honzik1 closed 8 years ago

honzik1 commented 8 years ago

I tryed to generate new project on Win7 and it failed with following exception. It seems the paths are not ready for windows usage :/

D:\apps\griffin\bin>griffin new ..\test


            __   /'**_\  /'**_\  __

_ _ /\ /\ / /\ / /\ /' \ /\'\/\ \ \ ,\ \ ,**\/\ \ /' `\ /\ \L\ \ \ \/ \ \ \ \ / \ \ / \ \ \ /\ \/\ \ \ \ \ \ \ \ \ \ \ \ \ _\ \/L\ \// \// \// \// \// \//\// /_**/ // Heya! This is griffin. Your personal, fast and easy static site generator. (And an overall good guy) You have chosen to create your new griffin site at: ..\test\griffin I'd love to help you set up some initial settings for your site, so let's go. I'll ask you a set of simple questions and you can type in your answer. Some questions have a default answer, which will be marked in brackets. You can just press enter to accept the default value in those cases.

  1. What would you like to call your site?(Your Own Griffin): Test
  2. Who's authoring this site? Me
  3. What will be the tagline for the site?(Not just another site):
  4. What will you like to name the folder where your posts will be stored?(content):
  5. What will you like to name the folder where the generated site will be stored?(output):
  6. What will you like to format the dates on yourData. posts and pages as?(yyyy MM dd):
  7. On what port will you like to see the live preview of your site?(9090):

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 2: /D:/apps/griffin/griffin.jar at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at com.pawandubey.griffin.Initializer.(Initializer.java:33) at com.pawandubey.griffin.Griffin.initialize(Griffin.java:106) at com.pawandubey.griffin.cli.NewCommand.execute(NewCommand.java:68) at com.pawandubey.griffin.Griffin.main(Griffin.java:302)

pawandubey commented 8 years ago

Thanks for the report. It should work since I have not made any unix specific path requirements in the code. I will try to reproduce it and get back to you.

honzik1 commented 8 years ago

I think it is caused by transforming CodeSourceLocation of ProtectionDomain to String (getPath). This line instead could work (Initializer.java:33)

Path jarRootPath = Paths.get(Initializer.class.getProtectionDomain().getCodeSource().getLocation().getURI()).getParent();

Sadly, I can't do push request for the moment, so I hope this helps.

pawandubey commented 8 years ago

This has now been fixed. As you said @honzik1 this was due to the getPath() on a Location object returning a string instead of a path. But now a new issue #38 has come up. Closing this for now.