diff options
author | Florian Bruhin <git@the-compiler.org> | 2014-10-26 19:42:01 +0100 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2014-10-26 19:42:01 +0100 |
commit | bb031b51f798e9ca343ed8de5d2213577df6dd50 (patch) | |
tree | c841df0a45d8bb685c92650e8cd0e1fb6a1f940c /scripts/utils.py | |
parent | d3b1a5efb4528ec3d7f93d76428cea2c77efa746 (diff) | |
download | qutebrowser-bb031b51f798e9ca343ed8de5d2213577df6dd50.tar.gz qutebrowser-bb031b51f798e9ca343ed8de5d2213577df6dd50.zip |
Make most scripts work if we're in scripts/ directory.
See #213.
Diffstat (limited to 'scripts/utils.py')
-rw-r--r-- | scripts/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/utils.py b/scripts/utils.py index daa3a7dcc..5b0c7dc72 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -20,6 +20,7 @@ """Utility functions for scripts.""" import os +import os.path use_color = True @@ -82,3 +83,10 @@ def print_bold(text): print(''.join([bold, text, reset])) else: print(text) + + +def change_cwd(): + """Change the scripts cwd if it was started inside the script folder.""" + cwd = os.getcwd() + if os.path.split(cwd)[1] == 'scripts': + os.chdir(os.path.join(cwd, os.pardir)) |