• Ryan Groch's avatar
    Feat: allow user to choose which directory to save Dyad apps in (#2875) · 583334f2
    Ryan Groch 提交于
    Closes #399. Adds a setting (under "General Settings") to select a
    custom directory to store new apps in, replacing the default `dyad-apps`
    folder.
    
    In order to make sure that users don't lose access to older apps, I
    opted for creating symlinks inside the new folder to the old app
    locations. I went with symlinking because moving every single app could
    be an expensive operation depending on how many apps there are, and the
    user might not want that. However, this is inconsistent with the import
    apps and move folder features (i.e. #2000), which copy the apps instead
    of symlinking.
    
    I'm happy to change the approach on request. Some options I've been
    thinking about:
    - Add a button in the settings which moves all the apps (replacing the
    symlinks) after the user chooses a new custom directory. This way, the
    user would get to choose.
    - Convert all of previously-created apps to absolute paths, which avoids
    all of the symlinking. The only potential issue with this is that if the
    user wants to move the apps to their new directory after all, they'd
    have to use the "move app" feature for every single app, otherwise the
    database wouldn't get updated. As is, they at least could just delete
    all the symlinks and mass-move all of their apps into the new directory
    (though they'd currently have to do this outside of Dyad).
    
    Also, since I'm tentatively adding in the use of symlinks, I modified
    the move/copy/delete app features so that they always target the true
    location of the app, not the symlink.
    
    I can also write tests if desired.
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2875"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    583334f2
paths.ts 4.3 KB