Skip to content

Commit

Permalink
Remove vertx.cwd system property support (#4826)
Browse files Browse the repository at this point in the history
This is undocumented and was only used in vertx-examples before Vert.x 5

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
  • Loading branch information
tsegismont authored Sep 1, 2023
1 parent a0344f3 commit 5d7cc0c
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/main/java/io/vertx/core/file/impl/FileResolverImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class FileResolverImpl implements FileResolver {
private static final boolean NON_UNIX_FILE_SEP = File.separatorChar != '/';
private static final String JAR_URL_SEP = "!/";

private final File cwd;
private final boolean enableCaching;
private final boolean enableCPResolving;
private final FileCache cache;
Expand All @@ -68,13 +67,6 @@ public FileResolverImpl(FileSystemOptions fileSystemOptions) {
} else {
cache = null;
}

String cwdOverride = System.getProperty("vertx.cwd");
if (cwdOverride != null) {
cwd = new File(cwdOverride).getAbsoluteFile();
} else {
cwd = null;
}
}

public String cacheDir() {
Expand Down Expand Up @@ -102,20 +94,14 @@ public void close() throws IOException {
public File resolveFile(String fileName) {
// First look for file with that name on disk
File file = new File(fileName);
File resolved;
boolean absolute = file.isAbsolute();

if (cwd != null && !absolute) {
resolved = new File(cwd, fileName);
} else {
resolved = file;
}
if (this.cache == null) {
return resolved;
return file;
}
// We need to synchronized here to avoid 2 different threads to copy the file to the cache directory and so
// corrupting the content.
if (!resolved.exists()) {
if (!file.exists()) {
synchronized (cache) {
// When an absolute file is here, if it falls under the cache directory, then it should be made relative as it
// could mean that a previous resolution has been used to resolve a non local file system resource
Expand Down

0 comments on commit 5d7cc0c

Please sign in to comment.