Convert a list intro a string and viceversa

I am creating an operating system with a built-in file system.
The file system works with lists, so all folders and files are stored in a list variable on snap!

I want users to have the ability to save their folders and files in a cloud variable and then be able to retrieve them.

My problem is that cloud variables are only stored in strings, so I need to make a reporter block that converts the filesystem list into a string, and another block to reverse the process, and I don't have any clue to do it.

I could use the combine block to insert a character between each item in the list, and then split by that character, but the list is more complex because there are lists inside that list.

Here's a visualization of that variable (disk):

image

As you can see in the list there are two folders; etc and tmp. Each folder has a content which is in the second column.
That content is another list like the root folder (the actual disk variable).

Here's the complete visualization of the etc folder (any folder is like that):

I've forgot to say that any folder or file has more content as you can see, the permissions, user and group.

summing up, I want to convert a complex list to a text string so that I can later convert it back to that complex list.

untitled script pic (4)
untitled script pic (2)
untitled script pic (3)

OMG, Thank you so much, I didn't know how to do that, you're incredible :smiley:

Question, what cloud variables are you using?

Watch these blocks in this project: you can store anything (text,number,list,boolean,costume,sound)
In addition, i store the value according to the user who is connected.
image

I'm using this:

CLOUD SYSTEM script pic

CLOUD SYSTEM script pic (1)

CLOUD SYSTEM script pic (2)

CLOUD SYSTEM script pic (3)

Do you recommend me other blocks?

Yes, as

@joecooldoo made some cloud variable blocks here.

to bh:

should you put this in the faq? or at least, block requests to Uni Göttingen's server in snap 7?

Both good ideas.

Hey @joecooldoo, I started using your cloud variables but it doesn't let me store large strings

Any solution?

I just updated the library. Just export the new ones then drag and drop the new version into Snap!. The old ones will get replaced. Just letting you know, space limits apply.

50 MB for total space
1000 bytes per key
5 MB per value

watch how i encode/decode automatically all type of data costume and sound if you need it...

image

Doesn't work

OK, It should work now.

Now it works but not for large strings:

And the string size is 2.5MB

Do it again so I can see the error server side. (@ Tag me when your ready.)

@joecooldoo I have done it again, and when I use "from cloud [red]" block it returns me 'red stuff' but not the string that I previously stored

The server doesn't throw an error, it just plain refuses to store so much data.

Try local storage.

Okay, I did some testing and you can store a maximum of 1047857 length string. That will be enough for me! :slight_smile: