19 posts
Posted 30 January 2016 - 10:42 AM
Hey, i'm writing an updater for my program but my program has more
than just 1 file it uses other files in other directories, so i can't figure out
how i'm going to send a whole dir. trough rednet. Keeping i mind, other
files might be added in the future so i can't send it manually 1 by 1.
Edited on 30 January 2016 - 09:43 AM
275 posts
Location
Turkey
Posted 30 January 2016 - 10:53 AM
- First, you can send a index of files & directories as two files thru rednet.
- Then, you use a for loop to read the directory file line by line and create the directories from the file.
- After creating the directories, read the file index line by line using a for loop and use rednet.receive to get a file.
- Once you get the file, you create a file with the name of the contents in the current line in the file index. And write it there.
- Continue the loop until the end of the file.
You may need to modify the update sender to send files in the correct order.
19 posts
Posted 30 January 2016 - 10:57 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
Edited on 30 January 2016 - 09:58 AM
275 posts
Location
Turkey
Posted 30 January 2016 - 11:02 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
- Don't nest too much
- Don't remember. Just write them in a file and send the file thrugh rednet.
Edited on 30 January 2016 - 10:02 AM
19 posts
Posted 30 January 2016 - 11:08 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
- Don't nest too much
- Don't remember. Just write them in a file and send the file thrugh rednet.
But how does the program then known wich dirs. still need to be done DIR -> dir1 -> sending
-> dir2 -> needs to be send
275 posts
Location
Turkey
Posted 30 January 2016 - 11:17 AM
yeah, here is the problem , i'm struggling with remembering dirs. in dirs. in dirs. ,….
how could i solve this?
- Don't nest too much
- Don't remember. Just write them in a file and send the file thrugh rednet.
But how does the program then known wich dirs. still need to be done DIR -> dir1 -> sending
-> dir2 -> needs to be send
You create the directories before you send files.
19 posts
Posted 30 January 2016 - 11:40 AM
I'll let you know if i failed at it or if i succeeded, ok i'm going to test thisa bit
1583 posts
Location
Germany
Posted 30 January 2016 - 11:50 AM
It would be much easier to use some compression API/program, and send the archive over rednet.
19 posts
Posted 30 January 2016 - 02:18 PM
Yeah, thanks i did it