Skip to content

Commit 979d217

Browse files
Merge pull request #65 from haskellcamargo/revert-61-master
Revert "Add usage of XDG data dir for tokens"
2 parents 4c03fb9 + 7a26dc0 commit 979d217

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

app.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727

2828
SCLACK_SUBTYPE = 'sclack_message'
2929

30-
def get_token_file():
31-
base = os.path.expanduser(os.environ.get('XDG_DATA_HOME', '~'))
32-
return os.path.join(base, 'sclack')
33-
34-
TOKEN_FILE = get_token_file()
35-
3630

3731
class SclackEventLoop(urwid.AsyncioEventLoop):
3832
def run(self):
@@ -671,17 +665,17 @@ def quit_application(self):
671665
sys.exit()
672666

673667
def ask_for_token(json_config):
674-
if os.path.isfile(TOKEN_FILE):
675-
with open(TOKEN_FILE, 'r') as user_file:
668+
if os.path.isfile(os.path.expanduser('~/.sclack')):
669+
with open(os.path.expanduser('~/.sclack'), 'r') as user_file:
676670
# Compatible with legacy configuration file
677671
new_config = json.load(user_file)
678672
if not 'workspaces' in new_config:
679673
new_config['workspaces'] = {'default': new_config['token']}
680674
json_config.update(new_config)
681675
else:
682-
print('There is no %s file. Let\'s create one!' % TOKEN_FILE)
676+
print('There is no ~/.sclack file. Let\'s create one!')
683677
token = input('What is your Slack workspace token? ')
684-
with open(TOKEN_FILE, 'w') as config_file:
678+
with open(os.path.expanduser('~/.sclack'), 'w') as config_file:
685679
token_config = {'workspaces': {'default': token}}
686680
config_file.write(json.dumps(token_config, indent=False))
687681
json_config.update(token_config)

0 commit comments

Comments
 (0)