diff --git a/python/mozbuild/mozbuild/backend/cpp_eclipse.py b/python/mozbuild/mozbuild/backend/cpp_eclipse.py index 090dc66f199..07c81a9c3f5 100644 --- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py +++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py @@ -26,7 +26,7 @@ class CppEclipseBackend(CommonBackend): CommonBackend._init(self) self._paths_to_defines = {} - self._workspace_dir = os.path.join(self.environment.topobjdir, 'eclipse_workspace') + self._workspace_dir = self.get_workspace_path() self._project_dir = os.path.join(self._workspace_dir, 'gecko') self._macbundle = self.environment.substs['MOZ_MACBUNDLE_NAME'] @@ -48,6 +48,14 @@ class CppEclipseBackend(CommonBackend): self.summary.backend_detailed_summary = types.MethodType(detailed, self.summary) + def get_workspace_path(self): + # Eclipse doesn't support having the workspace inside the srcdir. + # Since most people have their objdir inside their srcdir it's easier + # and more consistent to just put the workspace along side the srcdir + srcdir_parent = os.path.dirname(self.environment.topsrcdir) + workspace_dirname = "eclipse_" + os.path.basename(self.environment.topobjdir) + return os.path.join(srcdir_parent, workspace_dirname) + def consume_object(self, obj): obj.ack()