mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-06-11 08:57:52 +02:00
239e073a8c
- Migrate MainActivity from FlutterActivity to FlutterFragmentActivity for SAF picker compatibility - Add ImpellerAwareFlutterFragment to support Impeller fallback on legacy devices - Add output_fd support in Go backend for direct file descriptor writes (SAF) - Add helper functions in output_fd.go for FD-based file operations - Refactor Tidal/Qobuz/Amazon downloaders to support FD output and skip metadata embedding for SAF (handled by Flutter) - Add extractQobuzDownloadURLFromBody with unit tests for robust URL parsing - Add storage mode picker (SAF vs App folder) in download settings for Android - Fix FFmpeg output path building to avoid same-path conflicts - Embed metadata to SAF FLAC files via temp file bridge in Flutter - Upgrade Gradle wrapper to 9.3.1 and add activity-ktx dependency
32 lines
574 B
Go
32 lines
574 B
Go
package gobackend
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func isFDOutput(outputFD int) bool {
|
|
return outputFD > 0
|
|
}
|
|
|
|
func openOutputForWrite(outputPath string, outputFD int) (*os.File, error) {
|
|
if isFDOutput(outputFD) {
|
|
return os.NewFile(uintptr(outputFD), fmt.Sprintf("saf_fd_%d", outputFD)), nil
|
|
}
|
|
return os.Create(outputPath)
|
|
}
|
|
|
|
func cleanupOutputOnError(outputPath string, outputFD int) {
|
|
if isFDOutput(outputFD) {
|
|
return
|
|
}
|
|
|
|
path := strings.TrimSpace(outputPath)
|
|
if path == "" || strings.HasPrefix(path, "/proc/self/fd/") {
|
|
return
|
|
}
|
|
|
|
_ = os.Remove(path)
|
|
}
|