summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-01-21 20:45:39 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-01-21 20:45:39 +0100
commitbf5e5a5ba7408165918eb7d2398680ff245a48bb (patch)
treeda5b45015a36a2884c3d76d4fcebefecb1102873 /inc/io.php
parentb6c6979fa2bc2a54befe6a451579ce8ff5515445 (diff)
downloadrpg-bf5e5a5ba7408165918eb7d2398680ff245a48bb.tar.gz
rpg-bf5e5a5ba7408165918eb7d2398680ff245a48bb.tar.bz2
Windows compatible rename #683
darcs-hash:20060121194539-7ad00-c880c0980513a3ccb45253c02e1a02d4cbdd6009.gz
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index ff318bd67..9c02e87c6 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -319,6 +319,24 @@ function io_download($url,$file,$useAttachment=false,$defaultName=''){
}
/**
+ * Windows copatible rename
+ *
+ * rename() can not overwrite existing files on Windows
+ * this function will use copy/unlink instead
+ */
+function io_rename($from,$to){
+ if(!@rename($from,$to)){
+ if(@copy($from,$to)){
+ @unlink($from);
+ return true;
+ }
+ return false;
+ }
+ return true;
+}
+
+
+/**
* Runs an external command and returns it's output as string
*
* @author Harry Brueckner <harry_b@eml.cc>