@@ -196,25 +196,29 @@ public static String getVcapValue(String serviceName, String key, String plan) {
196196 /**
197197 * Creates a list of files to check for credentials. The file locations are:
198198 * * Location provided by user-specified IBM_CREDENTIALS_FILE environment variable
199+ * * Current working directory this code is being called in
199200 * * System home directory (Unix)
200201 * * System home directory (Windows)
201- * * Top-level directory of the project this code is being called in
202202 *
203203 * @return list of credential files to check
204204 */
205205 private static List <File > getFilesToCheck () {
206206 List <File > files = new ArrayList <>();
207207
208208 String userSpecifiedPath = EnvironmentUtils .getenv ("IBM_CREDENTIALS_FILE" );
209+ String currentWorkingDirectory = System .getProperty ("user.dir" );
209210 String unixHomeDirectory = EnvironmentUtils .getenv ("HOME" );
210211 String windowsFirstHomeDirectory = EnvironmentUtils .getenv ("HOMEDRIVE" ) + EnvironmentUtils .getenv ("HOMEPATH" );
211212 String windowsSecondHomeDirectory = EnvironmentUtils .getenv ("USERPROFILE" );
212- String projectDirectory = System .getProperty ("user.dir" );
213213
214214 if (StringUtils .isNotEmpty (userSpecifiedPath )) {
215215 files .add (new File (userSpecifiedPath ));
216216 }
217217
218+ if (StringUtils .isNotEmpty (currentWorkingDirectory )) {
219+ files .add (new File (String .format ("%s/%s" , currentWorkingDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
220+ }
221+
218222 if (StringUtils .isNotEmpty (unixHomeDirectory )) {
219223 files .add (new File (String .format ("%s/%s" , unixHomeDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
220224 }
@@ -227,10 +231,6 @@ private static List<File> getFilesToCheck() {
227231 files .add (new File (String .format ("%s/%s" , windowsSecondHomeDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
228232 }
229233
230- if (StringUtils .isNotEmpty (projectDirectory )) {
231- files .add (new File (String .format ("%s/%s" , projectDirectory , DEFAULT_CREDENTIAL_FILE_NAME )));
232- }
233-
234234 return files ;
235235 }
236236
0 commit comments