Skip to content

Commit dc5cb18

Browse files
committed
48 - Fix edge case with .sublime-project file not being in the same folder as the project files
1 parent cdb130e commit dc5cb18

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/libs/util.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,18 @@ def is_project_open(project):
635635
def is_javascript_project():
636636
project_file_name = sublime.active_window().project_file_name()
637637
project_dir_name = ""
638-
if project_file_name :
638+
if project_file_name:
639639
project_dir_name = os.path.dirname(project_file_name)
640640
settings_dir_name = os.path.join(project_dir_name, PROJECT_SETTINGS_FOLDER_NAME)
641641
return os.path.isdir(settings_dir_name)
642-
else :
643-
# try to look at window.folders()
644-
folders = sublime.active_window().folders()
645-
if len(folders) > 0:
646-
folders = folders[0]
647-
settings_dir_name = os.path.join(folders, PROJECT_SETTINGS_FOLDER_NAME)
648-
return os.path.isdir(settings_dir_name)
642+
643+
# If not found at the location of the .sublime-project file, try to look in the open folders.
644+
folders = sublime.active_window().folders()
645+
if len(folders) > 0:
646+
folders = folders[0]
647+
settings_dir_name = os.path.join(folders, PROJECT_SETTINGS_FOLDER_NAME)
648+
return os.path.isdir(settings_dir_name)
649+
649650
return False
650651

651652
def is_type_javascript_project(type):

0 commit comments

Comments
 (0)