-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix window path #5560
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
Fix window path #5560
Changes from 1 commit
1c721d8
a5e60dd
769233a
7727d51
0ff65a5
0a7ffbc
0c3e55b
4b3340f
23764fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,9 +167,9 @@ case class Site( | |
private def defaultParams(pageLocation: JFile, additionalDepth: Int = 0): DefaultParams = { | ||
val pathFromRoot = stripRoot(pageLocation) | ||
val baseUrl: String = { | ||
val rootLen = root.getAbsolutePath.split(sep).length | ||
val assetLen = pageLocation.getAbsolutePath.split(sep).length | ||
"../" * (assetLen - rootLen - 1 + additionalDepth) + "." | ||
val rootLen = root.toPath.normalize.getNameCount | ||
val assetLen = pageLocation.toPath.normalize.getNameCount | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you need to convert to absolute path as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usage of absolute path info in URL seems problematic. For now, I added |
||
"../" * (assetLen - rootLen + additionalDepth) + "." | ||
} | ||
|
||
DefaultParams( | ||
|
@@ -203,7 +203,7 @@ case class Site( | |
|
||
val path = if (scala.util.Properties.isWin) | ||
e.path.map(_.replace("<", "_").replace(">", "_")) | ||
else | ||
else | ||
e.path | ||
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + sep + "api" + sep + path.mkString(sep) + suffix)) | ||
val params = defaultParams(target.toFile, -1).withPosts(blogInfo).withEntity(Some(e)).toMap | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a conversion to File here? It seems we are only interested in the String representation of these paths. I would make the conversion to String explicit. E.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed,
toString
is better and I just tested it works on windows.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like Allan's suggestion and I will test it ASAP:
For comparison here is my local change (pending PR for several weeks now):
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way the same issue exists in source file
compiler/test/dotty/tools/vulpix/RunnerOrchestration.scala
.My local change in function
createProcess
is:instead of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @michelou . It seems there are a lot of changes needed for the tests. I propose to restrict this PR for the compiler fixes, and make a separate PR for the test fixes.