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
01c3efb8
Commit
01c3efb8
authored
Dec 27, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added "total_space" meta value to OSFS
parent
eb2dbaaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
fs/osfs/__init__.py
+13
-0
No files found.
fs/osfs/__init__.py
View file @
01c3efb8
...
@@ -176,6 +176,19 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
...
@@ -176,6 +176,19 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
else
:
else
:
stat
=
os
.
statvfs
(
self
.
root_path
)
stat
=
os
.
statvfs
(
self
.
root_path
)
return
stat
.
f_bfree
*
stat
.
f_bsize
return
stat
.
f_bfree
*
stat
.
f_bsize
elif
meta_name
==
'total_space'
:
if
platform
.
system
()
==
'Windows'
:
try
:
import
ctypes
total_bytes
=
ctypes
.
ulonglong
(
0
)
ctypes
.
windll
.
kernel32
.
GetDiskFreeSpaceExW
(
ctypes
.
c_wchar_p
(
self
.
root_path
),
None
,
ctypes
.
pointer
(
total_bytes
),
None
)
return
total_bytes
.
value
except
ImportError
:
# Fall through to call the base class
pass
else
:
stat
=
os
.
statvfs
(
self
.
root_path
)
return
stat
.
f_blocks
*
stat
.
f_bsize
return
super
(
OSFS
,
self
)
.
getmeta
(
meta_name
,
default
)
return
super
(
OSFS
,
self
)
.
getmeta
(
meta_name
,
default
)
...
...
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