Permalink
Browse files

Fix: Validity of Unity3D project folder was not correctly checked whe…

…n projectPath parameter was used.

Instead of checking the folder given via projectPath, moduleRoot was checked. Fixed that here by just commenting out the Unity3D project folder validity, because if it's invalid, Unity3D throws an error anyways.

Prepared code to check the projectPath folder, but left that commented out as time didn't permit extensive testing.
  • Loading branch information...
1 parent cb6c9cd commit 705a4c4b0554520e29cfa647246e2ea73b6ae7ef derFunk committed Jun 6, 2012
Showing with 31 additions and 5 deletions.
  1. +31 −5 src/main/java/org/jenkinsci/plugins/unity3d/Unity3dBuilder.java
@@ -128,9 +128,6 @@ private ArgumentListBuilder prepareCommandlineArguments(AbstractBuild build, Lau
FilePath moduleRoot = build.getModuleRoot();
String moduleRootRemote = moduleRoot.getRemote();
- if (!moduleRoot.child("Assets").exists()) {
- throw new PerformException(Messages.Unity3d_MissingAssetsNotAUnity3dProjectDirectory(moduleRootRemote));
- }
return createCommandlineArgs(exe, moduleRootRemote);
}
@@ -147,13 +144,42 @@ private Unity3dInstallation getAndConfigureUnity3dInstallation(BuildListener lis
return ui;
}
- ArgumentListBuilder createCommandlineArgs(String exe, String moduleRootRemote) {
+ ArgumentListBuilder createCommandlineArgs(String exe, String moduleRootRemote) throws PerformException {
@lacostej

lacostej Jun 6, 2012

this new throw isn't necessary if the code hasn't changed.

ArgumentListBuilder args = new ArgumentListBuilder();
args.add(exe);
+
if (!argLine.contains("-projectPath")) {
args.add("-projectPath", moduleRootRemote);
}
- args.add(QuotedStringTokenizer.tokenize(argLine));
+
+ String[] tokenizedArgs = QuotedStringTokenizer.tokenize(argLine);
+
+ /* TODO
@lacostej

lacostej Jun 6, 2012

What's this commented out code for ? Ouh. Got it. I just read the second line in your commit message. github commit message email notifications render strangely.

+ FilePath projectPath = null;
+ for (int i = 0; i < tokenizedArgs.length; i++){
+ if (tokenizedArgs[i].trim() == "-projectPath" && tokenizedArgs.length >= i+1)
+ {
+ projectPath = new FilePath(new File(tokenizedArgs[i+1]));
+ }
+ System.out.println("Command line token: " + tokenizedArgs[i]);
+ }
+
+ // check for valid unity3d folder by checking for assets folder
+ boolean assetFolderNotFound = false;
+ try {
+ if (projectPath == null || (projectPath != null && !projectPath.child("Assets").exists())) {
+ assetFolderNotFound = true;
+ }
+ } catch (Exception e) {
+ // Auto-generated catch block
+ assetFolderNotFound = true;
+ }
+
+ if (assetFolderNotFound)
+ throw new PerformException(Messages.Unity3d_MissingAssetsNotAUnity3dProjectDirectory(projectPath));
+ */
+
+ args.add(tokenizedArgs);
return args;
}

0 comments on commit 705a4c4

Please sign in to comment.