github.com/dolthub/dolt/go@v0.40.5-0.20240520175717-68db7794bea6/libraries/utils/file/open.go (about) 1 // Copyright 2021 Dolthub, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build !windows 16 // +build !windows 17 18 package file 19 20 import ( 21 "os" 22 ) 23 24 // The file issues are only observed on Windows, therefore on other platforms these function no differently than direct 25 // calls. 26 27 // Rename functions exactly like os.Rename, except that it retries upon failure on Windows. This "fixes" some errors 28 // that appear on Windows. 29 func Rename(oldpath, newpath string) error { 30 return os.Rename(oldpath, newpath) 31 } 32 33 // Remove functions exactly like os.Remove, except that it retries upon failure on Windows. This "fixes" some errors 34 // that appear on Windows. 35 func Remove(name string) error { 36 return os.Remove(name) 37 } 38 39 // RemoveAll functions exactly like os.RemoveAll, except that it retries upon failure on Windows. This "fixes" some errors 40 // that appear on Windows. 41 func RemoveAll(path string) error { 42 return os.RemoveAll(path) 43 }