summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@heap.zone>2019-05-18 01:43:28 +0200
committerJonathan Schleifer <js@heap.zone>2019-05-18 01:43:28 +0200
commit8399795120fd891d9b0d8af2cd6bf36f0290269f (patch)
treec284a603e47512471f8d2f9a086e9c61ebe408c9
parentf4e33856d0b4b92a961ea3089976a88028b5e9c6 (diff)
ofarc: Create output dir if missing
-rw-r--r--utils/ofarc/OFArc.m13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/ofarc/OFArc.m b/utils/ofarc/OFArc.m
index e0f29c00..36252591 100644
--- a/utils/ofarc/OFArc.m
+++ b/utils/ofarc/OFArc.m
@@ -414,9 +414,16 @@ writingNotSupported(OFString *type)
mode: mode
encoding: encoding];
- if (outputDir != nil)
- [[OFFileManager defaultManager]
- changeCurrentDirectoryPath: outputDir];
+ if (outputDir != nil) {
+ OFFileManager *fileManager =
+ [OFFileManager defaultManager];
+
+ if (![fileManager directoryExistsAtPath: outputDir])
+ [fileManager createDirectoryAtPath: outputDir
+ createParents: true];
+
+ [fileManager changeCurrentDirectoryPath: outputDir];
+ }
@try {
[archive extractFiles: files];