aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode-common
diff options
context:
space:
mode:
authorGravatar Daniel Wagner-Hall <danielwh@google.com>2015-03-17 19:34:08 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-03-18 13:45:31 +0000
commit4b3bf405257ae3145d5639cd6c3e7fad0e384f94 (patch)
tree3f3181d1d6e71048c2bc9fd8d7c5e07fd44732e7 /src/tools/xcode-common
parent5f6744550a98506ed680b389cfdc872fe07daed5 (diff)
Use the action-scoped tmpdir for temporary files
This is both the correct thing to do, and also makes it much more obvious when the Assets.car file and Info.plist file are being written to different directories for reasons of actool being crazy. -- MOS_MIGRATED_REVID=88853163
Diffstat (limited to 'src/tools/xcode-common')
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
index b4b3203386..282ce42641 100644
--- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
+++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zippingoutput/Wrappers.java
@@ -20,6 +20,7 @@ import com.google.devtools.build.xcode.zip.ZipInputEntry;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -38,14 +39,16 @@ public class Wrappers {
*/
public static void execute(String[] argsArray, Wrapper wrapper)
throws IOException, InterruptedException {
+ FileSystem filesystem = FileSystems.getDefault();
ArgumentsParsing argsParsing = ArgumentsParsing.parse(
- FileSystems.getDefault(), argsArray, wrapper.name(), wrapper.subtoolName());
+ filesystem, argsArray, wrapper.name(), wrapper.subtoolName());
for (String error : argsParsing.error().asSet()) {
System.err.printf(error);
System.exit(1);
}
+ Path tempDir = getTempDir(filesystem);
for (Arguments args : argsParsing.arguments().asSet()) {
- Path outputDir = Files.createTempDirectory("ZippingOutput");
+ Path outputDir = Files.createTempDirectory(tempDir, "ZippingOutput");
Path rootedOutputDir = outputDir.resolve(args.bundleRoot());
Files.createDirectories(
wrapper.outputDirectoryMustExist() ? rootedOutputDir : rootedOutputDir.getParent());
@@ -64,4 +67,12 @@ public class Wrappers {
}
}
}
+
+ private static Path getTempDir(FileSystem filesystem) {
+ String tempDir = System.getenv("TMPDIR");
+ if (tempDir == null) {
+ tempDir = "/tmp";
+ }
+ return filesystem.getPath(tempDir);
+ }
}