feat(frontend): use Wails bindings for file I/O
Replace hidden file inputs and anchor downloads with native open/save dialogs via a thin platform layer. WAV export sends base64 audio data to the Go backend for writing to the user-chosen path. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+7
-1
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -102,11 +103,16 @@ func (s *FileService) SaveProject(content string, defaultName string) error {
|
||||
return os.WriteFile(path, []byte(content), 0o644)
|
||||
}
|
||||
|
||||
func (s *FileService) SaveAudio(data []byte, defaultName string) error {
|
||||
func (s *FileService) SaveAudio(dataBase64 string, defaultName string) error {
|
||||
if defaultName == "" {
|
||||
defaultName = "keyboard_track.wav"
|
||||
}
|
||||
|
||||
data, err := base64.StdEncoding.DecodeString(dataBase64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
path, err := s.app.Dialog.SaveFile().
|
||||
SetMessage("Export Audio").
|
||||
SetFilename(defaultName).
|
||||
|
||||
Reference in New Issue
Block a user