Package: ranger / 1.6.1-1

0002-honour-various-TMPDIR-varaibles.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From: Vern Sun <s5unty@gmail.com>
Date: Sun, 23 Feb 2014 14:09:30 +0800
Subject: honour various TMPDIR varaibles

---
 ranger.py           |    2 +-
 ranger/__init__.py  |    3 ++-
 ranger/core/main.py |    5 +++--
 3 个文件被修改,插入 6 行(+),删除 4 行(-)

diff --git a/ranger.py b/ranger.py
index 49a3f36..d4f5377 100755
--- a/ranger.py
+++ b/ranger.py
@@ -10,7 +10,7 @@
 # default is simply "ranger". (Not this file itself!)
 # The other arguments are passed to ranger.
 """":
-tempfile='/tmp/chosendir'
+tempfile="$(dirname $(tempfile))/chosendir"
 ranger="${1:-ranger}"
 test -z "$1" || shift
 "$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"
diff --git a/ranger/__init__.py b/ranger/__init__.py
index 3d38c70..356be24 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 = 'sensible-pager'
-LOGFILE = '/tmp/ranger_errorlog'
+LOGFILE = tempfile.gettempdir()+'/ranger_errorlog'
 USAGE = '%prog [options] [path]'
 VERSION = 'ranger-stable %s\n\nPython %s' % (__version__, sys.version)
 
diff --git a/ranger/core/main.py b/ranger/core/main.py
index ff4e02d..24687ae 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"""
@@ -127,8 +128,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: