@@ -196,25 +196,29 @@ public static String getVcapValue(String serviceName, String key, String plan) {
196
196
/**
197
197
* Creates a list of files to check for credentials. The file locations are:
198
198
* * Location provided by user-specified IBM_CREDENTIALS_FILE environment variable
199
+ * * Current working directory this code is being called in
199
200
* * System home directory (Unix)
200
201
* * System home directory (Windows)
201
- * * Top-level directory of the project this code is being called in
202
202
*
203
203
* @return list of credential files to check
204
204
*/
205
205
private static List <File > getFilesToCheck () {
206
206
List <File > files = new ArrayList <>();
207
207
208
208
String userSpecifiedPath = EnvironmentUtils .getenv ("IBM_CREDENTIALS_FILE" );
209
+ String currentWorkingDirectory = System .getProperty ("user.dir" );
209
210
String unixHomeDirectory = EnvironmentUtils .getenv ("HOME" );
210
211
String windowsFirstHomeDirectory = EnvironmentUtils .getenv ("HOMEDRIVE" ) + EnvironmentUtils .getenv ("HOMEPATH" );
211
212
String windowsSecondHomeDirectory = EnvironmentUtils .getenv ("USERPROFILE" );
212
- String projectDirectory = System .getProperty ("user.dir" );
213
213
214
214
if (StringUtils .isNotEmpty (userSpecifiedPath )) {
215
215
files .add (new File (userSpecifiedPath ));
216
216
}
217
217
218
+ if (StringUtils .isNotEmpty (currentWorkingDirectory )) {
219
+ files .add (new File (String .format ("%s/%s" , currentWorkingDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
220
+ }
221
+
218
222
if (StringUtils .isNotEmpty (unixHomeDirectory )) {
219
223
files .add (new File (String .format ("%s/%s" , unixHomeDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
220
224
}
@@ -227,10 +231,6 @@ private static List<File> getFilesToCheck() {
227
231
files .add (new File (String .format ("%s/%s" , windowsSecondHomeDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
228
232
}
229
233
230
- if (StringUtils .isNotEmpty (projectDirectory )) {
231
- files .add (new File (String .format ("%s/%s" , projectDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
232
- }
233
-
234
234
return files ;
235
235
}
236
236
0 commit comments