The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Issue with folder creation (Operator.getParameterAsFile)
Hi,
I was just wondering, why the web crawler doesn't automatically generate folders required for the specified output location.
CrawlerOperator calls the method getParameterAsFile(String key, boolean createMissingDirectories) with the second parameter set to true. Having a look at the method from class Operator revealed the problem:
I will solve this with a temporary workaround for now. But if you can confirm the issue, you probably might want to fix this.
Best regards
Matthias
I was just wondering, why the web crawler doesn't automatically generate folders required for the specified output location.
CrawlerOperator calls the method getParameterAsFile(String key, boolean createMissingDirectories) with the second parameter set to true. Having a look at the method from class Operator revealed the problem:
Since the directory is not existing at the time where this code starts being executed, result.isDirectory() will always return false (this is at least the case on my Windows machine). As soon as the directory exists, it is correctly recognized as directory, but that doesn't help much in case where I want it to be created.
public java.io.File getParameterAsFile(String key, boolean createMissingDirectories) throws UndefinedParameterError {
String fileName = getParameter(key);
...
if (process != null) {
File result = process.resolveFileName(fileName);
if (createMissingDirectories) {
if (result.isDirectory()) {
result.mkdirs();
} else {
File parent = result.getParentFile();
if (parent != null)
parent.mkdirs();
}
}
return result;
}
I will solve this with a temporary workaround for now. But if you can confirm the issue, you probably might want to fix this.
Best regards
Matthias
Tagged:
0
Answers
I'm afraid I have to ask you again to file a bug report on the issue..
Regards,
Marco
last time your answer was much more appreciated I created all the bugs you asked for.
I'm wondering about my chance of becoming "Bug Filer of the Week"... there are four up to now, don't know if this will be enough
Regards
Matthias