filesystem module¶
Provides access to engine’s filesystem interface.
-
class
filesystem.
SeekType
¶ Bases:
Boost.Python.enum
-
CURRENT
= _filesystem.SeekType.CURRENT¶
-
HEAD
= _filesystem.SeekType.HEAD¶
-
TAIL
= _filesystem.SeekType.TAIL¶
-
names
= {'HEAD': _filesystem.SeekType.HEAD, 'CURRENT': _filesystem.SeekType.CURRENT, 'TAIL': _filesystem.SeekType.TAIL}¶
-
values
= {0: _filesystem.SeekType.HEAD, 1: _filesystem.SeekType.CURRENT, 2: _filesystem.SeekType.TAIL}¶
-
-
class
filesystem.
SourceFile
¶ Bases:
Boost.Python.instance
-
__init__
((object)arg1, (object)arg2) → None¶
-
close
((SourceFile)arg1) → None¶
-
fileno
((SourceFile)arg1) → int¶
-
flush
((SourceFile)arg1) → None¶
-
isatty
((SourceFile)arg1) → bool¶
-
static
open
((str)file_path[, (str)mode='rt'[, (str)path_id=None]]) → SourceFile¶
-
read
((SourceFile)arg1[, (Channel)size=-1]) → object¶
-
readable
((SourceFile)arg1) → bool¶
-
readline
((SourceFile)arg1[, (Channel)size=-1]) → object¶
-
readlines
((SourceFile)arg1[, (Channel)hint=-1]) → list¶
-
save
((SourceFile)arg1, (str)file_path) → None¶
-
seek
((SourceFile)arg1, (Channel)offset[, (Channel)whence=_filesystem.SeekType.HEAD]) → None¶
-
seekable
((SourceFile)arg1) → bool¶
-
tell
((SourceFile)arg1) → int¶
-
truncate
((SourceFile)arg1[, (Channel)size=-1]) → int¶
-
write
((SourceFile)arg1, (object)arg2) → None¶
-
writeable
((SourceFile)arg1) → bool¶
-
writelines
((SourceFile)arg1, (list)arg2) → None¶
-
closed
¶
-
eof
¶
-
handle
¶
-
size
¶
-
-
filesystem.
is_vpk_file
((str)arg1) → bool¶
-
filesystem.
source_file
(file_path)[source]¶ Ensures that the given file has a visible name on the file system.
Note
If the file was packed in a VPK archive, it gets copied to a temporary file. Thus, modifying the file has no effect on the original file.
Example:
with source_file('credits.txt') as file_path: print('Visible path:', file_path) with open(file_path) as f: print('Content:', f.read())