providers/os: Function rename converts the destination path properly

This commit is contained in:
Sasha Koshka 2025-03-27 19:44:42 -04:00
parent 67b263d8f0
commit f9b83d8d67

View File

@ -40,7 +40,7 @@ func (this *Provider) FuncMapFor (document *step.Document) template.FuncMap {
"appendFile": stat.funcAppendFile,
"removeFile": stat.funcRemoveFile,
"rename": stat.funcRename,
// TODO: createDir, createDirAll, removeDir, chmod
// TODO: temporary files, dirs
}
}
@ -159,6 +159,8 @@ func (this *state) funcRemoveFile (name string) error {
func (this *state) funcRename (name, newName string) error {
name, err := this.document.Rel(name)
if err != nil { return err }
newName, err = this.document.Rel(newName)
if err != nil { return err }
return os.Rename(name, newName)
}