Skip to content
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

Support for wildcard file filter #81

Open
johno1985 opened this issue Jul 23, 2018 · 0 comments
Open

Support for wildcard file filter #81

johno1985 opened this issue Jul 23, 2018 · 0 comments

Comments

@johno1985
Copy link

johno1985 commented Jul 23, 2018

Version 2.5.0

For our different environments in our deployment pipeline, our audit4j config file will have an environment name infix in the filename, e.g. 'audit4j.conf-qa.yml'

We then set the path using:

System.setProperty("audit4j.conf.file.path", System.getProperty("user.home") + File.separator + "audit4j-conf*.yml");

But this results in the following exception:

java.nio.file.InvalidPathException: Illegal char <*> at index 30: C:\Users\Jonathan\audit4j-conf*.yml

Could you use the following instead?

FileFilter fileFilter = new WildcardFileFilter(filename);
File[] files = dir.listFiles(fileFilter);
int count = files.length;
if (count != 1) {
	//file not found handling goes here
}

//file found handling goes here```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant