Skip to content

Fixes resource_strip_prefix on Windows #745

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ private static void copyResources(
dstr = resource.destination;
}

if (dstr.charAt(0) == '/') {
if (dstr.charAt(0) == '/' || dstr.charAt(0) == '\\') {
// we don't want to copy to an absolute destination
dstr = dstr.substring(1);
}
if (dstr.startsWith("../")) {
if (dstr.startsWith("../") || dstr.startsWith("..\\")) {
// paths to external repositories, for some reason, start with a leading ../
// we don't want to copy the resource out of our temporary directory, so
// instead we replace ../ with external/
Expand Down
10 changes: 10 additions & 0 deletions test/resource_strip_prefix/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("//scala:scala.bzl", "scala_library")

scala_library(
name = "test-lib",
srcs = glob(
["src/test/scala/**/*.scala"],
),
resource_strip_prefix = "test/resource_strip_prefix/src/test/resources",
resources = ["src/test/resources/resource.txt"],
)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object RootResources {

}