Sublime Forum

How to check whether there is a project open?

#1

How to check whether there is a project open?

For example, if I do the command on the menu Project -> Close Project, I know there is no project open.
However also, could not have any project open if the user never opened one.

Therefore how to simply call something and know for sure there are not project open?

0 Likes

#2

The project_file_name() method on the sublime.Window class returns None when you invoke it in an empty window or a window that has files/folders but no project open, so that may do what you want.

3 Likes

#3

Thank you.

0 Likes