Skip to content

Commit

Permalink
Merge pull request #299 from mjsrs/fix-force-bundle-dump
Browse files Browse the repository at this point in the history
+ Force dump to overwrite an existing Brewfile
  • Loading branch information
buresdv authored Apr 3, 2024
2 parents 85a83da + cafa724 commit f65f4f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Cork/Logic/Brewfile/Export Brewfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ func exportBrewfile(appState: AppState) async throws -> String
{
appState.isShowingBrewfileExportProgress = true

defer {
defer
{
appState.isShowingBrewfileExportProgress = false
}

let brewfileParentLocation: URL = URL.temporaryDirectory
let brewfileParentLocation = URL.temporaryDirectory

let pathRawOutput = await shell(URL(string: "/bin/pwd")!, ["-L"])

async let brewfileDumpingResult: TerminalOutput = await shell(AppConstants.brewExecutablePath, ["bundle", "dump"], workingDirectory: brewfileParentLocation)
async let brewfileDumpingResult: TerminalOutput = await shell(AppConstants.brewExecutablePath, ["bundle", "-f", "dump"], workingDirectory: brewfileParentLocation)

/// Throw an error if the working directory could not be determined
if !pathRawOutput.standardError.isEmpty
Expand All @@ -35,7 +36,8 @@ func exportBrewfile(appState: AppState) async throws -> String
}

/// Throw an error if the working directory is so fucked up it's unusable
guard let workingDirectory: URL = URL(string: pathRawOutput.standardOutput.replacingOccurrences(of: "\n", with: "")) else
guard let workingDirectory = URL(string: pathRawOutput.standardOutput.replacingOccurrences(of: "\n", with: ""))
else
{
throw BrewfileDumpingError.couldNotDetermineWorkingDirectory
}
Expand Down

0 comments on commit f65f4f0

Please sign in to comment.