Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken on windows #6

Open
cbonami opened this issue Jul 27, 2022 · 6 comments
Open

Broken on windows #6

cbonami opened this issue Jul 27, 2022 · 6 comments

Comments

@cbonami
Copy link

cbonami commented Jul 27, 2022

I get this error:

C:\..\..\..\..\src\main\java\be\..\ce\..\docs   structurizr +3 | ?33 ~5  puml-for-markdown
Processing md file at C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/01-context.md
FATAL EXCEPTION
Error: Could not find puml for md link path = ./puml/a.puml, absolute path = C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\puml\a.puml
    at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:171:23
    at String.replace (<anonymous>)
    at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:167:20
    at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:38:16
    at Array.map (<anonymous>)
    at replaceIgnore (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:36:45)
    at replaceMdIgnoringInlineCode (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:44:12)
    at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:52:57
    at C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:38:16
    at Array.map (<anonymous>)
    at replaceIgnore (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:36:45)
    at replaceMdIgnoringCodeBlocks (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:48:12)
    at replaceMdIgnoringCode (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:52:12)
    at processMdFile (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:166:36)
    at runOnce (C:\Users\cbonami\scoop\persist\nodejs\bin\node_modules\puml-for-markdown\index.js:216:34)

But the puml file is there, it's in the path C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\puml\a.puml.

The .../docs folder contains the file 01-context.md:

<!--![TimespendLapse](./puml/a.puml) -->

The .../docs/puml folder contains the file a.puml:

@startuml
class User {
  -String id
  -String name
  +String name()
}
User <|-- SpecificUser
@enduml

Plz note that I am on Windows.
Placing the file in the same folder than the md file doesn't help.
It doesn't find the puml-file while it is right there where it expects it !

I think it is the same issue than #5 but the error msg is a bit different.

@cbonami
Copy link
Author

cbonami commented Jul 27, 2022

I debugged it.

It's due to forward vs backward slash problem :/

In the map pumlLinks you have a key: 'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/puml/aggregate-timespendlapse.puml':

[
  [
    'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/aggregate-timespendlapse.puml',
    {
      encodedData: 'SoWkIImgAStDuULApaaiBbO8BKujKgZcvL9Gq0qkAShCIrV8J47cvINcfeBusaXy3KrUhbfUBh1McnfTNONWWjJapBJCP908BvT3QbuAq0O0',
      url: 'https://tinyurl.com/2atnl4pe',
....

But the pumlPath that is resolved is 'C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\aggregate-timespendlapse.puml'

This has backward slashes on Windows !!

So pumlPath is never found in pumlLinks.

So this fixes it: at line 168 in index.js:

const pumlPath = path.resolve(path.dirname(mdPath), mdPumlLinkPath).replaceAll('\\','/')

@OsirisTerje
Copy link

I believe it is more than that. Seems it works on Linux, but not on Windows.
It looks for a path with forward slashes like: D:/repos/fhi/lmr/Fhi.Legemiddelregisteret.wiki/Testing/miljoer.md
But crashes when trying to get it using backwards slashes.
D:\repos\fhi\lmr\Fhi.Legemiddelregisteret.wiki\Testing\miljoer.puml

No way of trying to change the slashes back or forward helps.

@danielyaa5
Copy link
Owner

@OsirisTerje @cbonami unfortunately I don't have a windows machine to test this on, if you find a fix, would you mind opening a PR?

@danielyaa5 danielyaa5 changed the title Error: Could not find puml for md link path Broken on windows Aug 9, 2022
@scmay
Copy link

scmay commented Aug 30, 2022

I debugged it.

It's due to forward vs backward slash problem :/

In the map pumlLinks you have a key: 'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/puml/aggregate-timespendlapse.puml':

[
  [
    'C:/javadev/workspace/ce-calendar-timespend-backend/structurizr/src/main/java/be/acerta/ce/calendar/docs/aggregate-timespendlapse.puml',
    {
      encodedData: 'SoWkIImgAStDuULApaaiBbO8BKujKgZcvL9Gq0qkAShCIrV8J47cvINcfeBusaXy3KrUhbfUBh1McnfTNONWWjJapBJCP908BvT3QbuAq0O0',
      url: 'https://tinyurl.com/2atnl4pe',
....

But the pumlPath that is resolved is 'C:\javadev\workspace\ce-calendar-timespend-backend\structurizr\src\main\java\be\acerta\ce\calendar\docs\aggregate-timespendlapse.puml'

This has backward slashes on Windows !!

So pumlPath is never found in pumlLinks.

So this fixes it: at line 168 in index.js:

const pumlPath = path.resolve(path.dirname(mdPath), mdPumlLinkPath).replaceAll('\\','/')

I made this change but still getting error.

@danielyaa5
Copy link
Owner

@scmay can you provide us with the full logs?

@scmay
Copy link

scmay commented Aug 31, 2022 via email

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

No branches or pull requests

4 participants