This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
pkg/analyzer_cli/lib/src/fix Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,9 @@ class Server {
97
97
98
98
/**
99
99
* Find the root directory of the analysis_server package by proceeding
100
- * upward to the 'test' dir, and then going up one more directory.
100
+ * upward until finding the Dart SDK repository root then returning
101
+ * the analysis_server package root within the repository.
102
+ * Return `null` if it cannot be found.
101
103
*/
102
104
static String findRoot ([String pathname]) {
103
105
pathname ?? = Platform .script.toFilePath (windows: Platform .isWindows);
@@ -106,12 +108,10 @@ class Server {
106
108
if (parent.length >= pathname.length) {
107
109
return null ;
108
110
}
109
- String name = basename (pathname);
110
- if (['benchmark' , 'test' ].contains (name)) {
111
- return parent;
112
- }
113
- if (name == 'pkg' ) {
114
- return join (pathname, 'analysis_server' );
111
+ String root = normalize (join (parent, 'pkg' , 'analysis_server' ));
112
+ String server = join (root, 'bin' , 'server.dart' );
113
+ if (new File (server).existsSync ()) {
114
+ return root;
115
115
}
116
116
pathname = parent;
117
117
}
You can’t perform that action at this time.
0 commit comments