Skip to content

Commit

Permalink
Add 'Show in path' button and other improvements to game settings view
Browse files Browse the repository at this point in the history
  • Loading branch information
vapidinfinity committed Jan 30, 2024
1 parent 97202a1 commit 1389b99
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mythic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2282;
CURRENT_PROJECT_VERSION = 2283;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
DEVELOPMENT_TEAM = 67ZBY275P8;
Expand Down Expand Up @@ -778,7 +778,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2282;
CURRENT_PROJECT_VERSION = 2283;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
DEVELOPMENT_TEAM = 67ZBY275P8;
Expand Down
29 changes: 29 additions & 0 deletions Mythic/Views/GameList/Extensions/GameSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ extension GameListView {
@State private var isWineSectionExpanded: Bool = true
@State private var isDXVKSectionExpanded: Bool = true

@State private var gamePath: String?

// MARK: - Body View
var body: some View {
VStack {
Expand Down Expand Up @@ -123,6 +125,30 @@ extension GameListView {
}
}
}
.disabled(gamePath == nil)
}
HStack {
VStack {
HStack {
Text("Game location")
Spacer()
}

HStack {
Text(URL(filePath: (gamePath ?? "[Unknown]")).prettyPath()) // FIXME: 3x repetition is bad
.foregroundStyle(.placeholder)
Spacer()
}
}

Spacer()

Button("Show in Finder") {
NSWorkspace.shared.activateFileViewerSelecting(
[URL(filePath: gamePath ?? .init())]
)
}
.disabled(gamePath == nil)
}
}

Expand All @@ -142,6 +168,9 @@ extension GameListView {
}
.formStyle(.grouped)
}
.onAppear {
gamePath = game.isLegendary ? try? Legendary.getGamePath(game: game) : game.path
}
.task {
if game.isLegendary {
metadata = try? Legendary.getGameMetadata(game: game) // FIXME: currently unused
Expand Down

0 comments on commit 1389b99

Please sign in to comment.