Skip to content

Commit

Permalink
Merge pull request #26 from zdog234/patch-2
Browse files Browse the repository at this point in the history
Add support for PROGRAMFILES installations
  • Loading branch information
LostConnection authored Jul 8, 2019
2 parents b475b48 + 1449dab commit 7e1b162
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions makeitdark.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,21 @@
slack_theme_path = "/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"
else:
# Probably Windows
slack_root_path = os.path.join(os.environ['LOCALAPPDATA'], "slack")
most_recent = sorted([slack_version for slack_version in os.listdir(slack_root_path) if slack_version.startswith("app-") and os.path.isdir(os.path.join(slack_root_path, slack_version))], reverse=True)[0]
print("Searching for most recent slack update in {0}".format(slack_root_path))
print("Found {0}".format(most_recent))
slack_theme_path = os.path.join(slack_root_path, most_recent, "resources", "app.asar.unpacked", "src", "static", "ssb-interop.js")
for root in os.environ['LOCALAPPDATA'], os.environ['PROGRAMFILES']:
slack_root_path = os.path.join(root, "slack")
slack_versions = sorted([slack_version for slack_version in os.listdir(slack_root_path) if slack_version.startswith("app-") and os.path.isdir(os.path.join(slack_root_path, slack_version))], reverse=True)
if not slack_versions:
continue

most_recent = slack_versions[0]
print("Searching for most recent slack update in {0}".format(slack_root_path))
print("Found {0}".format(most_recent))
slack_theme_path = os.path.join(slack_root_path, most_recent, "resources", "app.asar.unpacked", "src", "static", "ssb-interop.js")
if not os.path.exists(slack_theme_path):
continue
break
else:
raise EnvironmentError("Could not find slack installation")

if undo_mode:
with open(slack_theme_path, "r+") as f:
Expand Down

0 comments on commit 7e1b162

Please sign in to comment.