Skip to content

Commit

Permalink
Fix invalid dir creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
danpashin committed Jun 25, 2024
1 parent e183fca commit ec8b908
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions twackup-gui/Twackup.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
0B47A8762C2AD8790043B8A7 /* LSApplicationProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LSApplicationProxy.h; sourceTree = "<group>"; };
0B47A8792C2AD8790043B8A7 /* LSBundleProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LSBundleProxy.h; sourceTree = "<group>"; };
0B47A87D2C2AD8790043B8A7 /* LSResourceProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LSResourceProxy.h; sourceTree = "<group>"; };
0B47A8822C2AD9690043B8A7 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
0B47A8842C2AD9700043B8A7 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
0B48B1B72C22B04600D21737 /* DebsListVC+BlankSlate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DebsListVC+BlankSlate.swift"; sourceTree = "<group>"; };
0B48B1B92C22B2CD00D21737 /* DpkgListVC+BlankSlate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DpkgListVC+BlankSlate.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -500,7 +499,6 @@
isa = PBXGroup;
children = (
0B47A8842C2AD9700043B8A7 /* MobileCoreServices.framework */,
0B47A8822C2AD9690043B8A7 /* CoreServices.framework */,
CEF70D3062CF0C2BA7D149B4 /* Pods_Twackup.framework */,
);
name = Frameworks;
Expand Down
7 changes: 5 additions & 2 deletions twackup-gui/Twackup/Sources/FFI Models/Dpkg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ actor Dpkg {
}

var isDir: ObjCBool = true
let exists = FileManager.default.fileExists(atPath: url.path, isDirectory: &isDir)
var exists = FileManager.default.fileExists(atPath: url.path, isDirectory: &isDir)

// Application is not usable without directories created
// swiftlint:disable force_try
if exists && !isDir.boolValue {
try! FileManager.default.removeItem(at: url)
} else if !exists {
exists = false
}

if !exists {
try! FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
}
// swiftlint:enable force_try
Expand Down

0 comments on commit ec8b908

Please sign in to comment.