Skip to content

replace illegal chars in entity path (Windows) #5561

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

Merged
merged 1 commit into from
Dec 3, 2018
Merged

replace illegal chars in entity path (Windows) #5561

merged 1 commit into from
Dec 3, 2018

Conversation

michelou
Copy link
Contributor

@michelou michelou commented Dec 3, 2018

For instance the entity path <empty> is not legal on Windows:

testing ./bin/dotd
Compiling (1/1): HelloWorld.scala
[doc info] Generating doc page for: <empty>
Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <<> at index 59: C:\Users\appveyor\AppData\Local\Temp\1\dotty_out\_site/api/<empty>/index.html
	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 scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dottydoc.staticsite.Site.createOutput(Site.scala:186)
	at dotty.tools.dottydoc.staticsite.Site.generateApiDocs(Site.scala:230)
	at dotty.tools.dottydoc.DocDriver.process(DocDriver.scala:52)
	at dotty.tools.dotc.Driver.process(Driver.scala:135)
	at dotty.tools.dotc.Driver.process(Driver.scala:147)
	at dotty.tools.dotc.Driver.main(Driver.scala:174)
	at dotty.tools.dottydoc.Main.main(Main.scala)

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for your contribution @michelou

e.path.map(_.replace("<", "_").replace(">", "_"))
else
e.path
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + "/api/" + path.mkString("/") + suffix))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to change "/" as well?

Copy link
Contributor Author

@michelou michelou Dec 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check if mkdirs() (and other functions used in doc-tool) do support both kinds of file separator. If yes, we can save time and extra work (besides keeping the code shorter) !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if necessary we can do in another PR.

@liufengyun liufengyun merged commit 24a2798 into scala:master Dec 3, 2018
@michelou michelou deleted the doc-tool branch February 10, 2020 11:27
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

Successfully merging this pull request may close these issues.

3 participants