diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/source_builder/SystemHelpers.py | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'utils/source_builder/SystemHelpers.py')
| -rw-r--r-- | utils/source_builder/SystemHelpers.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/source_builder/SystemHelpers.py b/utils/source_builder/SystemHelpers.py new file mode 100644 index 0000000..9a3ecd7 --- /dev/null +++ b/utils/source_builder/SystemHelpers.py @@ -0,0 +1,30 @@ +import os + +szBaseDir = os.getcwd() + +# changes to a new directory, independent of where we are on the drive +def ChangeDir(szDest): + os.chdir(szBaseDir + szDest) + +# deletes a file of disk, ignoring any assert if the file doesn't exist +def DeleteFile(szFile): + try: + os.unlink(szFile) + except OSError, e: + pass + +# returns true if a file exists on disk +def FileExists(szFile): + try: + os.stat(szFile) + return 1 + except OSError, e: + return + +def ListFiles(szExtension): + try: + szAllFiles = os.listdir(os.getcwd()) + return szAllFiles + except OSError, e: + return + |