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
266e2aaa
Commit
266e2aaa
authored
Sep 03, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better long-path handling on win32
parent
2b2fbce1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
fs/osfs.py
+12
-11
No files found.
fs/osfs.py
View file @
266e2aaa
...
@@ -11,23 +11,28 @@ try:
...
@@ -11,23 +11,28 @@ try:
except
ImportError
:
except
ImportError
:
xattr
=
None
xattr
=
None
class
OSFS
(
FS
):
class
OSFS
(
FS
):
"""Expose the underlying operating-system filesystem as an FS object.
"""Expose the underlying operating-system filesystem as an FS object.
This is the most basic of filesystems, which simply shadows the underlaying
This is the most basic of filesystems, which simply shadows the underlaying
filesytem of the OS. Most of its methods simply defer to the corresponding
filesytem of the OS. Most of its methods simply defer to the corresponding
methods in the os and os.path modules.
methods in the os and os.path modules.
"""
"""
def
__init__
(
self
,
root_path
,
dir_mode
=
0700
,
thread_synchronize
=
True
):
def
__init__
(
self
,
root_path
,
dir_mode
=
0700
,
thread_synchronize
=
True
):
FS
.
__init__
(
self
,
thread_synchronize
=
thread_synchronize
)
FS
.
__init__
(
self
,
thread_synchronize
=
thread_synchronize
)
expanded_path
=
normpath
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
os
.
path
.
expandvars
(
root_path
))))
root_path
=
os
.
path
.
expanduser
(
os
.
path
.
expandvars
(
root_path
))
if
not
os
.
path
.
exists
(
expanded_path
):
root_path
=
os
.
path
.
normpath
(
os
.
path
.
abspath
(
root_path
))
raise
ResourceNotFoundError
(
expanded_path
,
msg
=
"Root directory does not exist:
%(path)
s"
)
# Enable long pathnames on win32
if
not
os
.
path
.
isdir
(
expanded_path
):
if
sys
.
platform
==
"win32"
:
if
not
root_path
.
startswith
(
"
\\\\
?
\\
"
):
root_path
=
u"
\\\\
?
\\
"
+
root_path
if
not
os
.
path
.
exists
(
root_path
):
raise
ResourceNotFoundError
(
root_path
,
msg
=
"Root directory does not exist:
%(path)
s"
)
if
not
os
.
path
.
isdir
(
root_path
):
raise
ResourceInvalidError
(
expanded_path
,
msg
=
"Root path is not a directory:
%(path)
s"
)
raise
ResourceInvalidError
(
expanded_path
,
msg
=
"Root path is not a directory:
%(path)
s"
)
self
.
root_path
=
normpath
(
os
.
path
.
abspath
(
expanded_path
))
self
.
root_path
=
root_path
self
.
dir_mode
=
dir_mode
self
.
dir_mode
=
dir_mode
def
__str__
(
self
):
def
__str__
(
self
):
...
@@ -35,11 +40,7 @@ class OSFS(FS):
...
@@ -35,11 +40,7 @@ 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
)
return
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
@convert_os_errors
@convert_os_errors
def
open
(
self
,
path
,
mode
=
"r"
,
**
kwargs
):
def
open
(
self
,
path
,
mode
=
"r"
,
**
kwargs
):
...
...
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