Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Today I was trying to resolve one problem that affects how Windows path are used by Windows system, at first I though we could do something in java part (in fact we can) but look this case:
Asciidoctor asciidoctor = Asciidoctor.Factory.create(); Map<String, Object> options = OptionsBuilder.options().inPlace(false).safe(SafeMode.UNSAFE).asMap(); options.put("to_file", "target/b.html"); String render = asciidoctor.render("This is", options); System.out.println(render); In theory a file should be rendered on currentDirectory/target/b.html but an exception is thrown: Exception in thread "main" org.jruby.exceptions.RaiseException: (IOError) target directory does not exist: C:/Documents and Settings/alex/sandbox-workspace/demo/C:/Documents and Settings/alex/sandbox-workspace/demo/target see that in this case I am not using an absolute path, it is an String which is passed directly to Ruby code. Any ideas? This is the related issue (https://github.com/asciidoctor/asciidoctor-java-integration/issues/36) |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
As a matter of fact, I just fixed it :) My unit test for path resolving were passing, but it was the integration tests that were failing. I had a wrong assumption about what value Ruby assigns to File::SEPARATOR. I thought on Windows it would be a backslash. It turns out, the File::SEPARATOR is always forward slash. It's File::ALT_SEPARATOR that is conditionally set to backslash on Windows.
Now the path resolution logic resolves all Windows paths to the posix variant (which Ruby actually prefers). (That also solved another bug). That means after cleaning the following path:
C:\Users\writer\docs
It will be: C:/Users/writer/docs Of course, all the base path stuff is now working correctly. All 906 tests pass on Windows :) -Dan On Thu, May 16, 2013 at 12:27 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: Today I was trying to resolve one problem that affects how Windows path are used by Windows system, at first I though we could do something in java part (in fact we can) but look this case: ... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by asotobu
By "just fixed it", I mean its in origin/master :)
On Thu, May 16, 2013 at 2:18 AM, Dan Allen <[hidden email]> wrote:
... [show rest of quote] Dan Allen | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
cool, then it would work with relative and absolute paths, so I close the issue in asciidoctor-java-project, and next version of asciidoctor will fix this problem.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
You got it! -Dan On Thu, May 16, 2013 at 2:24 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: cool, then it would work with relative and absolute paths, so I close the issue in asciidoctor-java-project, and next version of asciidoctor will fix this problem. Dan Allen | http://google.com/profiles/dan.j.allen
|
Free forum by Nabble | Edit this page |