github.com/goplus/llgo@v0.8.3/py/os/os.go (about) 1 /* 2 * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package os 18 19 import ( 20 _ "unsafe" 21 22 "github.com/goplus/llgo/py" 23 ) 24 25 // https://docs.python.org/3/library/os.html 26 27 // Rename the file or directory src to dst. If dst exists, the operation will 28 // fail with an OSError subclass in a number of cases: 29 // 30 // On Windows, if dst exists a FileExistsError is always raised. The operation 31 // may fail if src and dst are on different filesystems. Use shutil.move() to 32 // support moves to a different filesystem. 33 // 34 // On Unix, if src is a file and dst is a directory or vice-versa, an IsADirectoryError 35 // or a NotADirectoryError will be raised respectively. If both are directories and dst 36 // is empty, dst will be silently replaced. If dst is a non-empty directory, an OSError 37 // is raised. If both are files, dst will be replaced silently if the user has permission. 38 // The operation may fail on some Unix flavors if src and dst are on different filesystems. 39 // If successful, the renaming will be an atomic operation (this is a POSIX requirement). 40 // 41 //go:linkname Rename py.rename 42 func Rename(src, dst *py.Object) *py.Object