X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bin%2Fbrowser_stack.py;h=7018dc6527e69a4b33676a0e3862c537411c3b64;hb=b3a4be7f2eb82f3cd7ac12ce316f4fc9cd4cbf76;hp=b81e6da6caa29634c91ba20560583bb81011e06f;hpb=f46bd4d41cc7f243bc8a321effee5200aa69e709;p=dotfiles.git diff --git a/bin/browser_stack.py b/bin/browser_stack.py old mode 100755 new mode 100644 index b81e6da..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