Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
repo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YongjieWang
repo
Commits
db2da597
Commit
db2da597
authored
Sep 15, 2015
by
Matthias Putz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portable: fixing diverse file handling issues
parent
357d4603
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
portable.py
portable.py
+20
-0
project.py
project.py
+4
-2
No files found.
portable.py
View file @
db2da597
...
@@ -3,7 +3,9 @@ import os
...
@@ -3,7 +3,9 @@ import os
import
pager
import
pager
import
platform
import
platform
import
re
import
re
import
shutil
import
socket
import
socket
import
stat
import
sys
import
sys
import
subprocess
import
subprocess
import
threading
import
threading
...
@@ -18,6 +20,24 @@ if isUnix():
...
@@ -18,6 +20,24 @@ if isUnix():
def
to_windows_path
(
path
):
def
to_windows_path
(
path
):
return
path
.
replace
(
'/'
,
'
\\
'
)
return
path
.
replace
(
'/'
,
'
\\
'
)
def
rmtree
(
path
):
shutil
.
rmtree
(
path
,
onerror
=
onerror
)
def
rename
(
src
,
dst
):
if
isUnix
():
os
.
rename
(
src
,
dst
)
else
:
if
os
.
path
.
exists
(
dst
):
os
.
remove
(
dst
)
os
.
rename
(
src
,
dst
)
def
onerror
(
function
,
path
,
excinfo
):
if
not
os
.
access
(
path
,
os
.
W_OK
):
os
.
chmod
(
path
,
stat
.
S_IWUSR
)
function
(
path
)
else
:
raise
def
input_reader
(
src
,
dest
,
std_name
):
def
input_reader
(
src
,
dest
,
std_name
):
if
isUnix
():
if
isUnix
():
...
...
project.py
View file @
db2da597
...
@@ -55,7 +55,8 @@ def _lwrite(path, content):
...
@@ -55,7 +55,8 @@ def _lwrite(path, content):
fd
.
close
()
fd
.
close
()
try
:
try
:
os
.
rename
(
lock
,
path
)
# os.rename(lock, path)
portable
.
rename
(
lock
,
path
)
except
OSError
:
except
OSError
:
os
.
remove
(
lock
)
os
.
remove
(
lock
)
raise
raise
...
@@ -2401,7 +2402,8 @@ class Project(object):
...
@@ -2401,7 +2402,8 @@ class Project(object):
self
.
_CopyAndLinkFiles
()
self
.
_CopyAndLinkFiles
()
except
Exception
:
except
Exception
:
if
init_dotgit
:
if
init_dotgit
:
shutil
.
rmtree
(
dotgit
)
# shutil.rmtree(dotgit)
portable
.
rmtree
(
dotgit
)
raise
raise
def
_gitdir_path
(
self
,
path
):
def
_gitdir_path
(
self
,
path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment