Skip to content

Commit bb20cc0

Browse files
authored
Merge pull request #588 from fglock/fix/filespec-abs2rel-curdir
fix(File::Spec): abs2rel returns "." when path equals base
2 parents 1fd59f7 + cd66b27 commit bb20cc0

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/org/perlonjava/core/Configuration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public final class Configuration {
3333
* Automatically populated by Gradle/Maven during build.
3434
* DO NOT EDIT MANUALLY - this value is replaced at build time.
3535
*/
36-
public static final String gitCommitId = "435af2ae7";
36+
public static final String gitCommitId = "f7bbbc40b";
3737

3838
/**
3939
* Git commit date of the build (ISO format: YYYY-MM-DD).
@@ -48,7 +48,7 @@ public final class Configuration {
4848
* Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at"
4949
* DO NOT EDIT MANUALLY - this value is replaced at build time.
5050
*/
51-
public static final String buildTimestamp = "Apr 28 2026 14:34:02";
51+
public static final String buildTimestamp = "Apr 28 2026 14:48:58";
5252

5353
// Prevent instantiation
5454
private Configuration() {

src/main/java/org/perlonjava/runtime/perlmodule/FileSpec.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,11 @@ public static RuntimeList abs2rel(RuntimeArray args, int ctx) {
528528
}
529529

530530
String relPath = baseObj.relativize(pathObj).toString();
531+
// Perl's File::Spec->abs2rel returns "." (curdir) when path equals base,
532+
// but Java's Path.relativize returns an empty string in that case.
533+
if (relPath.isEmpty()) {
534+
relPath = ".";
535+
}
531536
return new RuntimeScalar(relPath).getList();
532537
}
533538

0 commit comments

Comments
 (0)