ID:1896529
 
Is there any way for me to let admins download any Savefile located at a specific folder on the host's machine, to their own computer?
It can be done. Why don't u do something like this: src<<file("File") that should do the trick.

Maybe you can do something like:
mob/Player/proc/DownloadFile(fileName,downloader)
downloader<<file(fileName)

var/tmp/HostName = "Misticone"

mob/Player/verb/GetFile()
var/tmp/Host_
for(var/mob/Player/m in world)
if(m:name == HostName)
Host_ = m
Host_:DownloadFile("PlayerX.sav",src)


PS: I haven't tested this yet so please let me know if there is any problem.
Unfortunately that's not how file() works. You'll want ftp() instead, it'll send the file to the client and allow the client to select where to save it and what to save it as.

src << ftp("ServerFile.ext")
// Or
src << ftp("ServerFile.ext","WeRecommendYouSaveItAsThis.ext")
In response to Nadrew
Nadrew wrote:
Unfortunately that's not how file() works.

Correct me if I am wrong but this src<<file("ReadMe.txt") will open the file on the client's computer. After that, the client can simply save it in his computer.

In response to Misticone
And just a comment on the code you did post, that's some terrible stuff in general. You're making a tmp variable for "Host_" but not type-casting it, so you're forcing yourself to use the : operator (which should really never be used outside of some very niche situations), and you're looping over the world needlessly when you should just be setting a reference to the host when they join the game and using that.

var/tmp/client/Host

client/New()
..()
if(ckey == ckey(world.host)) Host = src

mob/Player/verb/GetMySaveFile()
set src in oview(usr)
if(Host != usr.client)
usr << "Only the game host can use this!"
return
usr << ftp("saves/[src.ckey].sav","[src.ckey].sav")


Although, ideally you'd make this a verb that's only accessible to the host, and simply have them select from a list of players (which should also be manually handled instead of looping over the world)
In response to Misticone
Misticone wrote:
Nadrew wrote:
Unfortunately that's not how file() works.

Correct me if I am wrong but this src<<file("ReadMe.txt") will open the file on the client's computer. After that, the client can simply save it in his computer.


It'll attempt to load the file without giving the client any control over how it loads it, which is far from ideal in this situation since just opening a savefile isn't going to do you much good. There's not going to be an easy way to save the file after the fact to the local file system either, you'd be jumping through a ton of needless hoops.

The OP asked how to download the file, not view it :)
In response to Nadrew
Humm ok Nadrew, thanks. I guess we always learn by making mistakes.
Thank you for all of your replays :)
I didn't know about the FTP command before..
But what should I do if I'd like to save the whole Folder instead of a single file? Will specifying the folder name (and it's path) in the ftp command be enouge?
You'd want to look into http://www.byond.com/developer/Dantom/zipfile, probably.