Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Mirror Directories #114

Open
dmopalmer opened this issue Jan 14, 2023 · 6 comments
Open

[Feature Request] Mirror Directories #114

dmopalmer opened this issue Jan 14, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@dmopalmer
Copy link

Editing a file directly on the target device is simple, but it is also error prone. After you save it and unmount the device, you have no further access to the file until you plug the device in again. You can't keep track of it in git, or put the same file on a second device. If your drone controller flies over the horizon, it takes your code with it.

I suggest that it would be a good feature to allow files to be edited on the desktop hard drive, to be automatically copied over to the device whenever changed. That way the files can reside in your local git-maintained directory. Also, code can be written without requiring you to be tethered to the device.

Not all files on the desktop should be copied over. (e.g. the .git directory, the .DS_Store files that MacOS litters everywhere, etc.)

One suggested implementation: A 'manifest' file listing the names of all files that should be mirrored to the device. Possibly with the behavior of saying 'don't include the .git directory, don't include the manifest file, but everything else goes'.

Another possible implementation: Everything in a subdirectory gets mirrored to the device with the same diskname. (By default the device will be named CIRCUITPYTHON, but you can rename it, which is especially useful if you are developing a system of two devices that talk to each other and you want to edit files for both devices at once.)

@dmopalmer dmopalmer added the bug Something isn't working label Jan 14, 2023
@0ge
Copy link

0ge commented Jan 31, 2023

A workaround is to use the Run on Save extension and configure it to copy your files. Add this to the workspace settings:

"emeraldwalk.runonsave": {
    "commands": [
        {
            "match": ".*\\.py",
            "isAsync": true,
            "cmd": "cp *.py /Volumes/CIRCUITPY/"
        }
    ]
}

(Note that if you are modifying lib-files or using subdirectories, you'll need to modify)

@johnwargo
Copy link

This is something I expected from the extension as well, the ability to work in a local project folder and interact with the device.

Not finding an option, I created a node module that automatically synchronizes files from the CircuitPython device to a local project folder while editing. This way you can use any editor you want and still maintain a local project folder with all of the code: https://www.npmjs.com/package/cpsync.

@Timmoth
Copy link

Timmoth commented Mar 13, 2023

A workaround is to use the Run on Save extension and configure it to copy your files. Add this to the workspace settings:

"emeraldwalk.runonsave": {
    "commands": [
        {
            "match": ".*\\.py",
            "isAsync": true,
            "cmd": "cp *.py /Volumes/CIRCUITPY/"
        }
    ]
}

(Note that if you are modifying lib-files or using subdirectories, you'll need to modify)

I just wrote a post for anyone looking for an easy way to do this on Windows

@jkozniewski
Copy link

A workaround is to use the Run on Save extension and configure it to copy your files. Add this to the workspace settings:

"emeraldwalk.runonsave": {
    "commands": [
        {
            "match": ".*\\.py",
            "isAsync": true,
            "cmd": "cp *.py /Volumes/CIRCUITPY/"
        }
    ]
}

(Note that if you are modifying lib-files or using subdirectories, you'll need to modify)

@0ge - thanks for the tip, regarding your note - any idea how to configure it so it's gonna be iterative and include subdirectories / lib folder ?

@0ge
Copy link

0ge commented Jan 6, 2024

There are many options you could use. I haven't tested these, but…

  • cp -r . /Volumes/CIRCUITPY/ would copy the entire directory, including vscode settings, git directories, etc.
  • cp ${file} /Volumes/CIRCUITPY/ would just copy the file you just saved

Additionally, Run on Save is capable of running multiple commands, so you can combine these. See its documentation for more guidance.

And if you are on Windows, you might want to use xcopy instead.

@axelmagnus
Copy link

also, some ideas in #144 that I closed now that I see that the request was already here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants