Skip to content

Commit

Permalink
JENKINS-17563 tentative fix for the file not found issue, potentially…
Browse files Browse the repository at this point in the history
… caused by some sort of non default workspace location
  • Loading branch information
lacostej committed May 15, 2013
1 parent 64110f5 commit 7aff00f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/testflight/TestflightRemoteRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static String prettySpeed(float speed) {
private File identifyDsym(String filePath, String ipaName) {
File dsymFile;
if (filePath != null && !filePath.trim().isEmpty()) {
dsymFile = new File(filePath);
dsymFile = findRelativeFile(filePath);
} else {
String fileName = FilenameUtils.removeExtension(ipaName);
Collection<File> files = FileUtils.listFiles(new File(remoteWorkspace), FileFilterUtils.nameFileFilter(fileName + "-dSYM.zip"), TrueFileFilter.INSTANCE);
Expand All @@ -116,12 +116,22 @@ private File identifyDsym(String filePath, String ipaName) {
private Collection<File> findIpaOrApkFiles(String filePath) {
Collection<File> files;
if (filePath != null && !filePath.trim().isEmpty()) {
files = Collections.singleton(new File(filePath));
files = Collections.singleton(findRelativeFile(filePath));
} else {
String[] extensions = {"ipa", "apk"};
boolean recursive = true;
files = FileUtils.listFiles(new File(remoteWorkspace), extensions, recursive);
}
return files;
}

private File findRelativeFile(String path) {
File f = new File(path);
if (f.exists())
return f;
f = new File(remoteWorkspace, path);
if (f.exists())
return f;
throw new IllegalArgumentException("Couldn't find file " + path + " in workspace " + remoteWorkspace);
}
}

0 comments on commit 7aff00f

Please sign in to comment.