Skip to content

Commit db30aaf

Browse files
fix(macos): salvar banco em Application Support no .app e limpar atributos xattr na release v2.4.1
1 parent 45e8dab commit db30aaf

4 files changed

Lines changed: 24 additions & 7 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ jobs:
119119
cp AppIcon.icns "$APP_BUNDLE/Contents/Resources/AppIcon.icns"
120120
rm -f AppIcon.icns
121121
122-
# 4. Assina o .app digitalmente (Ad-hoc Code Signing) para o Gatekeeper do macOS
122+
# 4. Remove atributos estendidos pré-existentes e assina o .app digitalmente (Ad-hoc)
123+
xattr -cr "$APP_BUNDLE"
123124
codesign --force --deep --sign - "$APP_BUNDLE"
124125
codesign --verify --deep --strict "$APP_BUNDLE"
125126

‎build/darwin/Info.plist‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<key>CFBundleIdentifier</key>
1414
<string>com.ademartellecher.ipmonitorapp</string>
1515
<key>CFBundleVersion</key>
16-
<string>2.4.0</string>
16+
<string>2.4.1</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.4.0</string>
18+
<string>2.4.1</string>
1919
<key>CFBundleIconFile</key>
2020
<string>AppIcon</string>
2121
<key>LSMinimumSystemVersion</key>

‎frontend/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<span class="nav-label">Sobre</span>
112112
<div class="about-tooltip-popover" id="aboutPopover">
113113
<div class="tooltip-header">
114-
<div class="tooltip-badge">v2.4.0</div>
114+
<div class="tooltip-badge">v2.4.1</div>
115115
<span class="tooltip-title">IP Monitor App</span>
116116
</div>
117117
<p class="tooltip-text">Monitoramento de conectividade ICMP Ping em tempo real, ultra-leve e portátil.</p>

‎internal/model/model.go‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,32 @@ import (
44
"database/sql"
55
"os"
66
"path/filepath"
7+
"runtime"
8+
"strings"
79

810
_ "modernc.org/sqlite"
911
)
1012

11-
// ResolveDBPath determina dinamicamente o caminho do banco de dados SQLite
12-
// Ele garante que o banco seja criado/usado na pasta onde o executável foi iniciado
13+
// ResolveDBPath determina dinamicamente o caminho do banco de dados SQLite.
14+
// No macOS, se estiver dentro de um .app bundle (/Contents/MacOS/), utiliza ~/Library/Application Support/IPMonitor.
15+
// No Windows e outros sistemas, utiliza a pasta onde o executável foi iniciado (portátil).
1316
func ResolveDBPath(defaultName string) string {
1417
if defaultName == "" {
15-
defaultName = "ipmonitor.db"
18+
defaultName = "ipMonitorDB.db"
19+
}
20+
21+
if runtime.GOOS == "darwin" {
22+
exePath, err := os.Executable()
23+
if err == nil && strings.Contains(exePath, ".app/Contents/MacOS") {
24+
homeDir, err := os.UserHomeDir()
25+
if err == nil {
26+
appSupportDir := filepath.Join(homeDir, "Library", "Application Support", "IPMonitor")
27+
_ = os.MkdirAll(appSupportDir, 0755)
28+
return filepath.Join(appSupportDir, defaultName)
29+
}
30+
}
1631
}
32+
1733
exePath, err := os.Executable()
1834
if err == nil {
1935
exeDir := filepath.Dir(exePath)

0 commit comments

Comments
 (0)