dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.08k stars 1.56k forks source link

FileSystemException while building project #36615

Open pinnisi opened 5 years ago

pinnisi commented 5 years ago

run "webdev serve" on my project (that worked well in dart 1.x) give me lots of errors like this:

`webdev serve Creating build script, took 13070ms [INFO] Setting up file watchers completed, took 19ms [INFO] Waiting for all file watchers to be ready completed, took 458ms [INFO] Building new asset graph completed, took 7.1s [INFO] Checking for unexpected pre-existing outputs. completed, took 1ms [SEVERE] build_modules:module_library on "my-long-path".dart:

FileSystemException: Cannot create file, path = '"my-long-path".dart_tool/build/generated/ "my-long-path".module.library' (OS Error: Impossibile trovare il percorso specificato. , errno = 3) [SEVERE] build_modules:module_library on "my-long-path".dart`

already tried the workaround of registry settings as issue #27825 but with no luck.

of course I can shorten path names, but it's a really huge project with many branches, will be a big problem that can delay dart2 migration

a-siva commented 5 years ago

Can you elaborate a bit more on which part of the Dart SDK you are using, dart2js or the dart VM, also were you using the IDE or was this done on the command line. It would be great if you could detail the steps you took after installing the Dart SDK to get to this error.

sigmundch commented 5 years ago

I believe this relates to webdev and build_runner

@jakemac53 @natebosch - what would be the correct repo to move this bug to? https://github.com/dart-lang/webdev/?

natebosch commented 5 years ago

@sigmundch - no, this is an SDK issue. If the VM cannot handle long file names there isn't a whole lot we can do about it on the build system side. Switching to relative paths could be risky for us and it's not clear to me it would be possible in all cases.

pinnisi commented 5 years ago

Can you elaborate a bit more on which part of the Dart SDK you are using, dart2js or the dart VM, also were you using the IDE or was this done on the command line. It would be great if you could detail the steps you took after installing the Dart SDK to get to this error.

I'm using IntelliJ, but I run "webdev serve" from command line. To reproduce, just create a path longer than 260 chars (including .dart_tool/build/generated/ ...)

a-siva commented 5 years ago

/cc @bkonyi

bkonyi commented 5 years ago

MAX_PATH is defined as 260 characters on Windows. If you're using a path longer than that, you need to prefix it with \\?\ as stated here. We'll have to investigate whether or not this prefix is something we can automatically do on Windows without any unintended side effects.