File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,16 @@ class CodeBuilder extends Builder {
112112 // need to prefix imports with as many '../' to be relative from root.
113113 final rootPath = _dir (buildStep);
114114 final outPath = _outDir (buildStep);
115- final rootDir = Directory (rootPath);
116- var outDir = Directory (outPath);
115+ final rootDir = Directory (rootPath).absolute ;
116+ var outDir = Directory (outPath).absolute ;
117117 var prefix = '' ;
118+
119+ if (! outDir.path.startsWith (rootDir.path)) {
120+ throw InvalidGenerationSourceError (
121+ 'configured output_dir ${outDir .path } is not a '
122+ 'subdirectory of the source directory ${rootDir .path }' );
123+ }
124+
118125 while (outDir.path != rootDir.path) {
119126 final parent = outDir.parent;
120127 if (parent.path == outDir.path) {
You can’t perform that action at this time.
0 commit comments