Commit ed93d1e3 authored by Jonathan Maw's avatar Jonathan Maw
Browse files

_project.py: Use utils' search upwards helper when searching for project.conf

parent 282995a4
Loading
Loading
Loading
Loading
+8 −10
Original line number Original line Diff line number Diff line
@@ -659,17 +659,15 @@ class Project():
    #    LoadError if project.conf is not found
    #    LoadError if project.conf is not found
    #
    #
    def _find_project_dir(self, directory):
    def _find_project_dir(self, directory):
        directory = os.path.abspath(directory)
        project_directory = utils._search_upward_for_file(directory, _PROJECT_CONF_FILE)
        while not os.path.isfile(os.path.join(directory, _PROJECT_CONF_FILE)):
        if not project_directory:
            parent_dir = os.path.dirname(directory)
            # TODO: We can also find the project dir through a workspace
            if directory == parent_dir:
            raise LoadError(
            raise LoadError(
                LoadErrorReason.MISSING_PROJECT_CONF,
                LoadErrorReason.MISSING_PROJECT_CONF,
                '{} not found in current directory or any of its parent directories'
                '{} not found in current directory or any of its parent directories'
                .format(_PROJECT_CONF_FILE))
                .format(_PROJECT_CONF_FILE))
            directory = parent_dir


        return directory
        return project_directory


    def _load_plugin_factories(self, config, output):
    def _load_plugin_factories(self, config, output):
        plugin_source_origins = []   # Origins of custom sources
        plugin_source_origins = []   # Origins of custom sources