Index: pkg/analysis_server/test/integration/integration_tests.dart |
diff --git a/pkg/analysis_server/test/integration/integration_tests.dart b/pkg/analysis_server/test/integration/integration_tests.dart |
index 0e3827fe02ce4ad44f1f5bbd3deb79612827c0bb..22ba63ec7be096e01a35e666b6b90b9cb5efc7ff 100644 |
--- a/pkg/analysis_server/test/integration/integration_tests.dart |
+++ b/pkg/analysis_server/test/integration/integration_tests.dart |
@@ -568,6 +568,21 @@ class Server { |
} |
/** |
+ * Find the root directory of the analysis_server package by proceeding |
+ * upward to the 'test' dir, and then going up one more directory. |
+ */ |
+ String findRoot(String pathname) { |
+ while (basename(pathname) != 'test') { |
+ String parent = dirname(pathname); |
+ if (parent.length >= pathname.length) { |
+ throw new Exception("Can't find root directory"); |
+ } |
+ pathname = parent; |
+ } |
+ return dirname(pathname); |
+ } |
+ |
+ /** |
* Start the server. If [debugServer] is true, the server will be started |
* with "--debug", allowing a debugger to be attached. |
*/ |
@@ -579,10 +594,9 @@ class Server { |
// TODO(paulberry): move the logic for finding the script, the dart |
// executable, and the package root into a shell script. |
String dartBinary = Platform.executable; |
- String scriptDir = dirname(Platform.script.toFilePath(windows: |
+ String rootDir = findRoot(Platform.script.toFilePath(windows: |
Platform.isWindows)); |
- String serverPath = normalize(join(scriptDir, '..', '..', 'bin', |
- 'server.dart')); |
+ String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
List<String> arguments = []; |
if (debugServer) { |
arguments.add('--debug'); |