How to share files between sketches?

how to share files between sketches?
Like I want to have a class available in two of my sketches and don’t want to copy paste it all the time.

1 Like

hmm, can you explain more?

Let‘s say in folder A is a pde with some cool classes

he wants to use that pde in 2 different sketches being in Folders B and C

2 Likes

If you’re going to edit something in your class, the best way to do this would probably be a library.
If you have the same file in multiple sketches and don’t want to edit them at some point, the easiest way would probably be copy & pasting your .pde file into a different sketch folder.
Depending on your operating system, there might be some tools that do this work for you, but since Processing only has a really basic IDE, there’s no function to do this.

2 Likes

as i know, you can refer to the same file using absolute path like this:

img = loadImage("/home/humayung/Dropbox/test.png");
it worked on my linux.
just copy the full path to the file. do the same to the different sketches on different directories you wanna shared. tell me is it working

it’s true that this works for images and fonts and svg and stuff (assets)

but OP (original poster) was wanting to have a class available in two of his sketches

so he’s talking about pde, not images.

Remark

The idea of a shared class is interesting though.

Of course library is the answer, but it’s hard to make a lib.

Below this advanced level:

OP securet could have one reference folder with a test pde and a pde for the common class.

Now we could have a 2nd sketch (or some OS tool as DongKingKong0 said) to deploy (copy) the class pde to a couple (30) of folders from a list A.

When we change the class we deploy it again to all 30 folders from the list A.

When we make a new sketch that uses the class, we add its folder to the list A and deploy again.

Nice.

(I copy and paste all the time)

Chrisir

4 Likes

A related approach is compiling to jar, then including that jar in Processing (so that all sketches have access to it) – this is less complicated than making it a full library in Contributions Manager. For recent discussion see: