diff options
-rw-r--r-- | examples/bash_automatic_cd.sh | 2 | ||||
-rwxr-xr-x | ranger.py | 2 | ||||
-rw-r--r-- | ranger/__init__.py | 3 | ||||
-rw-r--r-- | ranger/core/main.py | 5 |
4 files changed, 7 insertions, 5 deletions
diff --git a/examples/bash_automatic_cd.sh b/examples/bash_automatic_cd.sh index ac96ea12..040bf21a 100644 --- a/examples/bash_automatic_cd.sh +++ b/examples/bash_automatic_cd.sh @@ -8,7 +8,7 @@ # original directory. function ranger-cd { - tempfile="$(mktemp)" + tempfile="$(mktemp -t tmp.XXXXXX)" /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" test -f "$tempfile" && if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then diff --git a/ranger.py b/ranger.py index 1d7e42e1..864acf27 100755 --- a/ranger.py +++ b/ranger.py @@ -9,7 +9,7 @@ # default is simply "ranger". (Not this file itself!) # The other arguments are passed to ranger. """": -tempfile="$(mktemp)" +tempfile="$(mktemp -t tmp.XXXXXX)" ranger="${1:-ranger}" test -z "$1" || shift "$ranger" --choosedir="$tempfile" "${@:-$(pwd)}" diff --git a/ranger/__init__.py b/ranger/__init__.py index e20f55d8..8a1e7459 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -10,6 +10,7 @@ program you want to use to open your files with. import sys import os +import tempfile # Information __license__ = 'GPL3' @@ -24,7 +25,7 @@ TIME_BEFORE_FILE_BECOMES_GARBAGE = 1200 MAX_RESTORABLE_TABS = 3 MACRO_DELIMITER = '%' DEFAULT_PAGER = 'less' -LOGFILE = '/tmp/ranger_errorlog' +LOGFILE = tempfile.gettempdir()+'/ranger_errorlog' CACHEDIR = os.path.expanduser("~/.cache/ranger") USAGE = '%prog [options] [path]' VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version) diff --git a/ranger/core/main.py b/ranger/core/main.py index 524a9a19..55102dc2 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -5,6 +5,7 @@ import os.path import sys +import tempfile def main(): """initialize objects and run the filemanager""" @@ -133,8 +134,8 @@ def main(): import pstats profile = None ranger.__fm = fm - cProfile.run('ranger.__fm.loop()', '/tmp/ranger_profile') - profile = pstats.Stats('/tmp/ranger_profile', stream=sys.stderr) + cProfile.run('ranger.__fm.loop()', tempfile.gettempdir()+'/ranger_profile') + profile = pstats.Stats(tempfile.gettempdir()+'/ranger_profile', stream=sys.stderr) else: fm.loop() except Exception: |