Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
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
OpenEdx
pyfs
Commits
2b2fbce1
Commit
2b2fbce1
authored
Sep 03, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support long paths (>> 260 chars) on win32
parent
974e63d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
fs/osfs.py
+4
-0
fs/tempfs.py
+10
-2
No files found.
fs/osfs.py
View file @
2b2fbce1
#!/usr/bin/env python
#!/usr/bin/env python
import
os
import
os
import
sys
from
fs.base
import
*
from
fs.base
import
*
from
fs.path
import
*
from
fs.path
import
*
...
@@ -35,6 +36,9 @@ class OSFS(FS):
...
@@ -35,6 +36,9 @@ class OSFS(FS):
def
getsyspath
(
self
,
path
,
allow_none
=
False
):
def
getsyspath
(
self
,
path
,
allow_none
=
False
):
path
=
relpath
(
path
)
.
replace
(
'/'
,
os
.
sep
)
path
=
relpath
(
path
)
.
replace
(
'/'
,
os
.
sep
)
sys_path
=
os
.
path
.
join
(
self
.
root_path
,
path
)
sys_path
=
os
.
path
.
join
(
self
.
root_path
,
path
)
# Enable long pathnames on win32
if
sys
.
platform
==
"win32"
:
sys_path
=
u"
\\\\
?
\\
"
+
os
.
path
.
abspath
(
sys_path
)
return
sys_path
return
sys_path
@convert_os_errors
@convert_os_errors
...
...
fs/tempfs.py
View file @
2b2fbce1
#!/usr/bin/env python
#!/usr/bin/env python
import
os
from
osfs
import
OSFS
from
osfs
import
OSFS
import
tempfile
import
tempfile
from
shutil
import
rmtree
class
TempFS
(
OSFS
):
class
TempFS
(
OSFS
):
...
@@ -37,7 +37,15 @@ class TempFS(OSFS):
...
@@ -37,7 +37,15 @@ class TempFS(OSFS):
if
not
self
.
_cleaned
and
self
.
exists
(
"/"
):
if
not
self
.
_cleaned
and
self
.
exists
(
"/"
):
self
.
_lock
.
acquire
()
self
.
_lock
.
acquire
()
try
:
try
:
rmtree
(
self
.
_temp_dir
)
# shutil.rmtree doesn't handle long paths on win32,
# so we walk the tree by hand.
entries
=
os
.
walk
(
self
.
root_path
,
topdown
=
False
)
for
(
dir
,
dirnames
,
filenames
)
in
entries
:
for
filename
in
filenames
:
os
.
remove
(
os
.
path
.
join
(
dir
,
filename
))
for
dirname
in
dirnames
:
os
.
rmdir
(
os
.
path
.
join
(
dir
,
dirname
))
os
.
rmdir
(
self
.
root_path
)
self
.
_cleaned
=
True
self
.
_cleaned
=
True
finally
:
finally
:
self
.
_lock
.
release
()
self
.
_lock
.
release
()
...
...
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