Commit e84ea06c authored by Amos Wenger's avatar Amos Wenger

Use CaseFix.Apply rather than string manipulation

parent c2717aae
Pipeline #14738 failed with stage
in 5 minutes and 40 seconds
......@@ -9,7 +9,7 @@ require (
github.com/itchio/go-brotli v0.0.0-20190702114328-3f28d645a45c
github.com/itchio/headway v0.0.0-20191015112415-46f64dd4d524
github.com/itchio/httpkit v0.0.0-20191016123402-68159f3a0f00
github.com/itchio/lake v0.0.0-20191018151306-175d146fd503
github.com/itchio/lake v0.0.0-20191018173418-af085e0239d0
github.com/itchio/randsource v0.0.0-20190703104731-3f6d22f91927
github.com/itchio/savior v0.0.0-20190702184736-b8b849654d01
github.com/itchio/screw v0.0.0-20191018161534-50266ea9752a
......
......@@ -64,6 +64,8 @@ github.com/itchio/kompress v0.0.0-20190703125833-0b2a6b182782 h1:JCEcOVLpRZpsrbR
github.com/itchio/kompress v0.0.0-20190703125833-0b2a6b182782/go.mod h1:YEdp1gs/LrGWRcZwYkw7MXli8lIcApwk6fgkAR+3moI=
github.com/itchio/lake v0.0.0-20191018151306-175d146fd503 h1:KPs9ftly88WHErzhyyCFxXKgM6FN/q9EH2HiKHefVXY=
github.com/itchio/lake v0.0.0-20191018151306-175d146fd503/go.mod h1:QzMCieUnffQvCeDF5vlDOcsjhtkERfeZE+eKy6KS0wg=
github.com/itchio/lake v0.0.0-20191018173418-af085e0239d0 h1:6MWYltjNZPnDA11nVTSXet9OdRMGnev61W8/IQe1Ado=
github.com/itchio/lake v0.0.0-20191018173418-af085e0239d0/go.mod h1:QzMCieUnffQvCeDF5vlDOcsjhtkERfeZE+eKy6KS0wg=
github.com/itchio/randsource v0.0.0-20190702184213-a7635a4cb94b/go.mod h1:lKWkyaS6DHSVoxVLw7mIeD+po2Kvwv1Hiy8+7VR1zZc=
github.com/itchio/randsource v0.0.0-20190703104731-3f6d22f91927 h1:5abFAYun3PFycBSXZnvXk0wqaPNiioSTIOZFf3I0J+A=
github.com/itchio/randsource v0.0.0-20190703104731-3f6d22f91927/go.mod h1:lKWkyaS6DHSVoxVLw7mIeD+po2Kvwv1Hiy8+7VR1zZc=
......
......@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"sort"
"strings"
"github.com/itchio/headway/state"
"github.com/itchio/savior/filesource"
......@@ -313,9 +312,12 @@ func (b *overlayBowl) fixExistingCase() error {
for _, fix := range stats.Fixes {
b.TargetContainer.ForEachEntry(func(e tlc.Entry) tlc.ForEachOutcome {
if strings.HasPrefix(e.GetPath(), fix.Old) {
e.SetPath(strings.Replace(e.GetPath(), fix.Old, fix.New, 1))
if newPath, changed := fix.Apply(e.GetPath()); changed {
e.SetPath(newPath)
}
// if strings.HasPrefix(e.GetPath(), fix.Old) {
// e.SetPath(strings.Replace(e.GetPath(), fix.Old, fix.New, 1))
// }
return tlc.ForEachContinue
})
......
......@@ -642,6 +642,22 @@ func Test_Scenarios(t *testing.T) {
},
},
})
runPatchingScenario(t, patchScenario{
name: "change case of unrelated directory",
v1: testDirSettings{
entries: []testDirEntry{
{path: "DataSomething.dll", seed: 0x1},
{path: "Data/Hello.txt", seed: 0x2},
},
},
v2: testDirSettings{
entries: []testDirEntry{
{path: "DataSomething.dll", seed: 0x1},
{path: "data/Hello.txt", seed: 0x2},
},
},
})
}
type ScenarioDirection int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment