Hey there...
I'm really not sure if anyone is able to help me, or if anyone here even has experience with similar situation, but I decided to ask anyway...
I have scripts in place for allowing me to process HTTP requests. I have written an automatic updating system to accompany the aforementioned HTTP request scripts. What the updating system does is send a simple get request to my server with the path of the file to download. Normally, this is enough to trigger the initial 'download' of the file in question; however, this does not allow me to specify where to save the file to.
So, I was faced with the issue of 'ensuring downloaded files are placed into their correct folders'. I got around this by making a simple method similar to below...
# from_dir_and_name - specifies the server path for the file to download. # to_dir_and_name - specifies the game folder path to save the file to. def download_file(from_dir_and_name, to_dir_and_name) get(from_dir_and_name) do |reply| # Proccess the request reply - ie, the file.. File.open(to_dir_and_name,'wb') { |file| file.write(reply) } end endAnd guess what, it worked!! However, for some reason the files I download are a *tiny* bit larger than the files stored on my server.
Example: I have 'FilenameABC', which is 1000 bytes exactly. When the game downloads this file into its designated folder, it will have increased in size by as much as 7 bytes.
Now, you may be thinking '7 bytes', its hardy different... But in my eyes, its very different. The actual file contents seems to be identical, but I haven't ran any extensive tests on them yet. I also have 'no eyed deer' what the cause of these extra byes could be.
So yea, there's a bit of 'backstory' for my post.
My main issue is that - in order for me to save the file where i desire, i must write the reply onto another file, which is creating excess bytes.
Is anyone able to provide any insight on what could cause this, or an alternative method for me to direct the file towards a designated path (into MyKewelFolder for example)
Many thanks in advance.
I'm really not sure if anyone is able to help me, or if anyone here even has experience with similar situation, but I decided to ask anyway...
I have scripts in place for allowing me to process HTTP requests. I have written an automatic updating system to accompany the aforementioned HTTP request scripts. What the updating system does is send a simple get request to my server with the path of the file to download. Normally, this is enough to trigger the initial 'download' of the file in question; however, this does not allow me to specify where to save the file to.
So, I was faced with the issue of 'ensuring downloaded files are placed into their correct folders'. I got around this by making a simple method similar to below...
# from_dir_and_name - specifies the server path for the file to download. # to_dir_and_name - specifies the game folder path to save the file to. def download_file(from_dir_and_name, to_dir_and_name) get(from_dir_and_name) do |reply| # Proccess the request reply - ie, the file.. File.open(to_dir_and_name,'wb') { |file| file.write(reply) } end endAnd guess what, it worked!! However, for some reason the files I download are a *tiny* bit larger than the files stored on my server.
Example: I have 'FilenameABC', which is 1000 bytes exactly. When the game downloads this file into its designated folder, it will have increased in size by as much as 7 bytes.
Now, you may be thinking '7 bytes', its hardy different... But in my eyes, its very different. The actual file contents seems to be identical, but I haven't ran any extensive tests on them yet. I also have 'no eyed deer' what the cause of these extra byes could be.
So yea, there's a bit of 'backstory' for my post.
My main issue is that - in order for me to save the file where i desire, i must write the reply onto another file, which is creating excess bytes.
Is anyone able to provide any insight on what could cause this, or an alternative method for me to direct the file towards a designated path (into MyKewelFolder for example)
Many thanks in advance.
