Use filpath.Join()

This commit is contained in:
Xpl0itU 2023-08-03 15:12:28 +02:00
parent ef35f366e5
commit d056005725
3 changed files with 5 additions and 4 deletions

View file

@ -24,7 +24,7 @@ func main() {
}
bundlePath := filepath.Join(filepath.Dir(filepath.Dir(execPath)))
filePath := filepath.Join(bundlePath, "Resources/lib/share/glib-schemas")
filePath := filepath.Join(bundlePath, "Resources", "lib", "share", "glib-schemas")
if _, err := os.Stat(filePath); os.IsNotExist(err) {
logger.Warning("glib-schemas not found")
} else {

View file

@ -764,7 +764,7 @@ queueProcessingLoop:
defer wg.Done()
tidStr := fmt.Sprintf("%016x", title.TitleID)
titlePath := fmt.Sprintf("%s/%s [%s] [%s]", selectedPath, normalizeFilename(title.Name), wiiudownloader.GetFormattedKind(title.TitleID), tidStr)
titlePath := filepath.Join(selectedPath, fmt.Sprintf("%s [%s] [%s]", normalizeFilename(title.Name), wiiudownloader.GetFormattedKind(title.TitleID), tidStr))
if err := wiiudownloader.DownloadTitle(tidStr, titlePath, mw.decryptContents, progressWindow, mw.getDeleteEncryptedContents(), mw.logger); err != nil {
errorChan <- err
return

View file

@ -6,6 +6,7 @@ import (
"crypto/sha1"
"fmt"
"os"
"path/filepath"
"reflect"
)
@ -13,11 +14,11 @@ var commonKey = []byte{0xD7, 0xB0, 0x04, 0x02, 0x65, 0x9B, 0xA2, 0xAB, 0xD2, 0xC
func checkContentHashes(path string, content contentInfo, cipherHashTree *cipher.Block) error {
cHashTree := *cipherHashTree
h3Data, err := os.ReadFile(fmt.Sprintf("%s/%s.h3", path, content.ID))
h3Data, err := os.ReadFile(filepath.Join(path, fmt.Sprintf("%s.h3", content.ID)))
if err != nil {
return fmt.Errorf("failed to read H3 hash tree file: %w", err)
}
encryptedFile, err := os.Open(fmt.Sprintf("%s/%s.app", path, content.ID))
encryptedFile, err := os.Open(filepath.Join(path, fmt.Sprintf("%s.app", content.ID)))
if err != nil {
return fmt.Errorf("failed to open encrypted file: %w", err)
}