Skip to content

Commit

Permalink
Fix: Add support for other OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Croebh committed Aug 20, 2021
1 parent 3a6d0c8 commit 3788586
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions avrae.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class workshopInformationGet(sublime_plugin.WindowCommand):
def run(self):
self.id = None
self.file_name = self.window.active_view().file_name() or ""
collection_file = os.path.split(self.file_name)[0] + "\\collection.id"
print(os.path.join(os.path.split(self.file_name)[0], "collection.id"))
collection_file = os.path.join(os.path.split(self.file_name)[0], "collection.id")
if self.file_name and os.path.exists(collection_file):
with open(collection_file) as f:
collection = json.load(f)
Expand Down Expand Up @@ -185,7 +186,7 @@ def run(self):
self.id = None
self.payload = self.window.active_view().substr(sublime.Region(0, self.window.active_view().size()))
self.file_name = self.window.active_view().file_name() or ""
collection_file = os.path.split(self.file_name)[0] + "\\collection.id"
collection_file = os.path.join(os.path.split(self.file_name)[0], "collection.id")
if self.file_name and os.path.exists(collection_file):
with open(collection_file) as f:
collection = json.load(f)
Expand Down Expand Up @@ -219,7 +220,7 @@ def run(self, contentType:str = "alias", key:str = "code"):
self.contentPlural = 'aliases' if 'alias' in self.contentType else 'snippets'
self.key = key
self.file_name = self.window.active_view().file_name() or ""
collection_file = os.path.split(self.file_name)[0] + "\\collection.id"
collection_file = os.path.join(os.path.split(self.file_name)[0], "collection.id")
if self.file_name and os.path.exists(collection_file):
with open(collection_file) as f:
collection = json.load(f)
Expand Down Expand Up @@ -270,8 +271,8 @@ def run(self, contentType:str = "alias", key:str = "code"):
self.file_name = self.window.active_view().file_name() or ""
self.name = os.path.splitext(os.path.split(self.file_name)[1])[0]

if self.file_name and os.path.exists(os.path.split(self.file_name)[0] + "\\collection.id"):
with open(os.path.split(self.file_name)[0] + "\\collection.id") as f:
if self.file_name and os.path.exists(os.path.join(os.path.split(self.file_name)[0], "collection.id")):
with open(os.path.join(os.path.split(self.file_name)[0], "collection.id")) as f:
collection = json.load(f)
if os.path.splitext(os.path.split(self.file_name)[1])[0] in collection[self.contentPlural]:
self.id = collection[self.contentPlural][self.name]
Expand Down

0 comments on commit 3788586

Please sign in to comment.