Skip to content

Assets (& cache) location should be user configurable #6

Open
@Nos78

Description

@Nos78

Related to issue #5 and #3 - if the path for both the project assets and the extension cache location were user-configurable, I doubt either of these issues would have been raised.

The resources directory in the latest android SDK is called 'res' rather than 'resources' - the README specifically instructs the user to construct their project as src/main/resources/drawable, which is fine if they are building the project themselves and from scratch, but many users may want to use this extension part way through the development of an existing app, and changing the project structure at this point becomes a hassle.

I personally have my workspace folder at the /app/src/main/.../etc/... level, so the path is wrong for me in any case - I need the path to be at the parent directory, so it would be app/src/... I've modified this myself, but I'm sure I'm not the only user who would prefer to configure this rather than re-organising their project or opening a new workspace at the /app/ directory just to get this extension working.

Also, the cache location, /media/drawable doesn't exist, vscode is not creating this directory when the extension is installed, and createOrShow() attempts to access it without checking if it exists. If these paths had been user configurable, I'm sure the developer would have immediately considered the case of this directory not existing.

In brief:

  • The paths used for the assets (both cache & asset location) are hard coded.
  • In addition, the cache is not being checked to see if it exists before trying to access it and throwing an exception immediately after a user presses F1 and tries to run it.

I've made a few changes, and will create pull requests (I'll split the change, just in case you don't want to make the cache location user-configurable, and I can see the sense in that if that is indeed the case).

  • Change 1: make the /src/main/res/drawable path configurable, and change the default to be /res/ (another pull request has already changed this default location, but it is still hard-coded)
  • Change 2: check that the /media/drawable cache location exists, and if not, create it before trying to copy or delete the contents.
  • Change 3: make /media/assets user configurable, for those like me that like to have these sorts of storage placed in /tmp/ so I know it is safe to delete when I want to free up space!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions