fix: use path.Join for embed.FS paths to fix Windows build
filepath.Join uses OS-specific separators (backslash on Windows), but embed.FS always uses forward slashes. This caused schema file lookups to fail during Wails binding generation on Windows.
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
_ "modernc.org/sqlite" // Register sqlite driver.
|
_ "modernc.org/sqlite" // Register sqlite driver.
|
||||||
"yellowjacket/backend/database/sql/sqlcgen"
|
"yellowjacket/backend/database/sql/sqlcgen"
|
||||||
@@ -61,7 +60,7 @@ func NewDB(logger *slog.Logger) (*DB, error) {
|
|||||||
|
|
||||||
for _, dirEntry := range dirEntries {
|
for _, dirEntry := range dirEntries {
|
||||||
if !dirEntry.IsDir() {
|
if !dirEntry.IsDir() {
|
||||||
filePath := filepath.Join("sql/schemas", dirEntry.Name())
|
filePath := path.Join("sql/schemas", dirEntry.Name())
|
||||||
sqlContent, err := fs.ReadFile(schemas, filePath)
|
sqlContent, err := fs.ReadFile(schemas, filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not read file %s: %w", filePath, err)
|
return nil, fmt.Errorf("could not read file %s: %w", filePath, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user