X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bin%2Fbrowser_stack.py;h=7018dc6527e69a4b33676a0e3862c537411c3b64;hb=ee139d78efb0d8d8f097c434c45c3d240571c996;hp=01a4e4b620ca1ff53a74949cac52917be642e574;hpb=cd0fdfee13066aa93daa036f7b0bc1166a83ca60;p=dotfiles.git diff --git a/bin/browser_stack.py b/bin/browser_stack.py old mode 100755 new mode 100644 index 01a4e4b..7018dc6 --- a/bin/browser_stack.py +++ b/bin/browser_stack.py @@ -1,17 +1,16 @@ -#! /usr/bin/env python import os, shutil -browser_stack = os.path.expanduser('~/.config/browser-stack') +browser_stack = os.path.expanduser('~/.cache/browser-stack') def get_stack(): try: - with open(browser_stack, 'rU') as stack_file: + with open(browser_stack, 'r') as stack_file: return stack_file.readlines() except IOError: # No such file return [] def save_stack(stack): - os.umask(0066) # octal -rw------- + os.umask(0o066) # octal -rw------- with open(browser_stack+'.tmp', 'w') as stack_file: stack_file.writelines(stack) shutil.copy(browser_stack+'.tmp', browser_stack) @@ -20,4 +19,5 @@ def save_stack(stack): def set_current_browser(): stack = get_stack() if stack: - os.environ['BROWSER'] = stack[0].strip() + os.environ['BROWSER'] = browser = stack[0].strip() + return browser