mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fixed weird windows path issue
This commit is contained in:
@@ -8,8 +8,7 @@ import (
|
|||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"github.com/stashapp/stash/logger"
|
"github.com/stashapp/stash/logger"
|
||||||
"runtime"
|
"github.com/stashapp/stash/utils"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var DB *sqlx.DB
|
var DB *sqlx.DB
|
||||||
@@ -44,10 +43,7 @@ func runMigrations(databasePath string) {
|
|||||||
Migrations: source.NewMigrations(),
|
Migrations: source.NewMigrations(),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Golang migrate has an issue where the \ isn't recognized as a valid on windows
|
databasePath = utils.FixWindowsPath(databasePath)
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
databasePath = strings.Replace(databasePath, "\\", "/", -1)
|
|
||||||
}
|
|
||||||
s, _ := WithInstance(packrSource)
|
s, _ := WithInstance(packrSource)
|
||||||
m, err := migrate.NewWithSourceInstance(
|
m, err := migrate.NewWithSourceInstance(
|
||||||
"packr2",
|
"packr2",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package ffmpeg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/stashapp/stash/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ func (e *Encoder) ScenePreviewVideoChunkCombine(probeResult VideoFile, concatFil
|
|||||||
args := []string{
|
args := []string{
|
||||||
"-v", "quiet",
|
"-v", "quiet",
|
||||||
"-f", "concat",
|
"-f", "concat",
|
||||||
"-i", concatFilePath,
|
"-i", utils.FixWindowsPath(concatFilePath),
|
||||||
"-y",
|
"-y",
|
||||||
"-c", "copy",
|
"-c", "copy",
|
||||||
outputPath,
|
outputPath,
|
||||||
|
|||||||
15
utils/windows.go
Normal file
15
utils/windows.go
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Sometimes the \ isn't recognized as valid on windows
|
||||||
|
func FixWindowsPath(str string) string {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return strings.Replace(str, "\\", "/", -1)
|
||||||
|
} else {
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user