providers/os: Function rename converts the destination path properly
This commit is contained in:
		
							parent
							
								
									67b263d8f0
								
							
						
					
					
						commit
						f9b83d8d67
					
				@ -40,7 +40,7 @@ func (this *Provider) FuncMapFor (document *step.Document) template.FuncMap {
 | 
				
			|||||||
		"appendFile":    stat.funcAppendFile,
 | 
							"appendFile":    stat.funcAppendFile,
 | 
				
			||||||
		"removeFile":    stat.funcRemoveFile,
 | 
							"removeFile":    stat.funcRemoveFile,
 | 
				
			||||||
		"rename":        stat.funcRename,
 | 
							"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 {
 | 
					func (this *state) funcRename (name, newName string) error {
 | 
				
			||||||
	name, err := this.document.Rel(name)
 | 
						name, err := this.document.Rel(name)
 | 
				
			||||||
	if err != nil { return err }
 | 
						if err != nil { return err }
 | 
				
			||||||
 | 
						newName, err = this.document.Rel(newName)
 | 
				
			||||||
 | 
						if err != nil { return err }
 | 
				
			||||||
	return os.Rename(name, newName)
 | 
						return os.Rename(name, newName)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user