You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current examples, when running in the IDE using ExampleRunner assume that the IDE working directory is set up to be the root directory of the vertx-examples project.
This is the case when running in IntelliJ but behaviour can vary in other IDEs, e.g. in Eclipse and NetBeans which set the cwd to be the directory of the Maven sub-module (e.g. the core-examples directory). This can result in examples that use file system access failing for those IDEs when running in the IDE.
To remedy this we can do some "intelligent" cwd resolution in the ExampleRunner class. We can detect the cwd being used with new File(".") and based on the path of that and the desired working directory we can calculate the cwd offset to use. This should work if the actual cwd is set to anything below the project root.
The text was updated successfully, but these errors were encountered:
I've made an initial implementation. Quite simple:
try {
// We need to use the canonical file. Without the file name is .
File current = new File(".").getCanonicalFile();
if (exampleDir.startsWith(current.getName()) && ! exampleDir.equals(current.getName())) {
exampleDir = exampleDir.substring(current.getName().length() + 1);
}
} catch (IOException e) {
// Ignore it.
}
The current examples, when running in the IDE using ExampleRunner assume that the IDE working directory is set up to be the root directory of the vertx-examples project.
This is the case when running in IntelliJ but behaviour can vary in other IDEs, e.g. in Eclipse and NetBeans which set the cwd to be the directory of the Maven sub-module (e.g. the core-examples directory). This can result in examples that use file system access failing for those IDEs when running in the IDE.
To remedy this we can do some "intelligent" cwd resolution in the ExampleRunner class. We can detect the cwd being used with
new File(".")
and based on the path of that and the desired working directory we can calculate the cwd offset to use. This should work if the actual cwd is set to anything below the project root.The text was updated successfully, but these errors were encountered: