felangel / mason

Tools which allow developers to create and consume reusable templates called bricks.
https://docs.brickhub.dev
964 stars 98 forks source link

fix: FileSystemException: Directory listing failed (activate brick with git on Windows) #496

Open DeMarcoMan opened 2 years ago

DeMarcoMan commented 2 years ago

Hello Felix,

We are using your tool for creating new pages/controllers in our apps and it helps us a lot, but we have an issue on Windows. On macOS we don't have this problem.

Description

We get this exception on WIndows:

FileSystemException: Directory listing failed, path = 'C:/Users/mwildenb/AppData/Local/Mason/Cache/git/rubigo_page_Z2l0QGJpdGJ1Y2tldC5vcmc6ZGFsb3N5L3J1Ymlnb19wYWdlLmdpdA==_e85b222e08c551eec5689f9629e45501bf0
52670\__brick__\lib\pages\{{#snakeCase}}{{page_id}}_{{page_name}}{{\snakeCase}}\{{#snakeCase}}{{page_id}}_{{page_name}}{{\*' (OS Error: The system cannot find the path specified.
, errno = 3)

Steps To Reproduce

  1. mason get
  2. mason make rubigo_page
  3. See error

Mason.yaml This is the mason.yaml:

bricks:
  rubigo_page:
    git:
      url: "git@bitbucket.org:dalosy/rubigo_page.git"
      path: 
      ref: V1.0.0

Additional Context We use the latest mason version: 0.1.0-dev.34

Related issues

56

75

felangel commented 2 years ago

Hi @DeMarcoMan 👋 Thanks for opening an issue!

Can you please provide a link to a minimal reproduction sample? I’m not able to access the bitbucket repository. Thanks!

DeMarcoMan commented 2 years ago

Hi Felix,

The rubigo_page repository is now public so you should be able to test this with the mason.yaml above.

felangel commented 2 years ago

@DeMarcoMan thanks! I'll take a look shortly 👍

salihagic commented 1 year ago

Hi, any updates on this?

felangel commented 1 year ago

Hi, any updates on this?

Sorry for the delay! I’ll have a look today, thanks!

Legendorik commented 1 year ago

Hello!

I also encountered this problem and did a little digging. It seems that the cause of the problem is the system's limitation to the maximum path length. It's only 260 characters on Windows 10 by default. In DeMarcoMan's description, the path length was 276 characters. In my case it was a little less - 268, but still the same exception.

FileSystemException: Directory listing failed, path = 'C:/Users/alexa/AppData/Local/Mason/Cache/git/mason_test_Z2l0QGdpdGh1Yi5jb206TGVnZW5kb3Jpay9tYXNvbl90ZXN0LmdpdA==_1be1ea19ef103cf450559df3e363aa32517be9f7/feature\__brick__\{{feature_name.snakeCase()}}\data\cache\{{#with_cache}}{{feature_name.snakeCase()}}_cache.dart{{\*' (OS Error: The system cannot find the path specified. , errno = 3)

I created a public repository with a reproducible example and instructions if it helps. I also tried to solve this problem by allowing long paths in the registry but to no avail. Are there any workarounds other than just shorter names?

ihorkozar commented 1 year ago

@Legendorik @DeMarcoMan Hey guys, did you find any workaround ?

jsroest commented 1 year ago

@felangel, is it possible to add this to the application manifest for the mason.exe?

<application xmlns="urn:schemas-microsoft-com:asm.v3">  
    <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">  
        <ws2:longPathAware>true</ws2:longPathAware>  
    </windowsSettings> 
</application>  

Together with the registry fix as explained in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry, it might solve this problem for Win10 and above.

jsroest commented 1 year ago

Hi @felangel, this issue probably stalls because of the "Question" label that is attached to it. Can you please have a look at this issue and the comments above? Thanks!

felangel commented 1 year ago

Hi @felangel, this issue probably stalls because of the "Question" label that is attached to it. Can you please have a look at this issue and the comments above? Thanks!

Sorry for the delay! It stalled due to Flutter Forward but I will take a look asap.

jsroest commented 1 year ago

We found a workaround by moving the MASON_CACHE folder closer to the root of the drive.

You can set the location of the mason cache folder by defining an environment variable MASON_CACHE that points, for example, to c:\mason_cache.

With this workaround, we can use our bricks again with Windows 🚀. see: feat: let us change the location of $HOME/.mason-cache #402