Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / copying a newly created file inside the app to a new folder

Author
Message
haliop
User Banned
Posted: 14th Jul 2013 15:56
so im creating some files as the app runs
and i want when "saved" to move them into a new folder

so i do like this:


first i create a temp folder inside media folder
generate the new file
and when i press save

it goes like this:



??? since AppGameKit or devices allow only one write folder... i need to move it somehow but i got no clue..
can anyone please help?

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 14th Jul 2013 16:37
Ah, I answered in my thread. If you need to make it look like it has moved. Simply read in the the file, save it in the directory you want, using the setrawwritepath command if needed. You will probably need to go back to your original folder with SetFolder("original folder name"). Then delete your original file afterwards. As I said in my other post, this probably only works in Windows.
There may be a better way, as I don't much play with this stuff.

haliop
User Banned
Posted: 14th Jul 2013 17:06
but you cant use SetRawWritePath since im on mobiles and not on windows or mac... this command has no use for me

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Jul 2013 17:52
haliop, you are absolutely correct. You cannot use SetRawWritePath on anything but Windows.

And you are not 'allowed' to write outside of the app sand box for iOS, Mac or Android.

Why do you need to copy the file to a new folder?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
haliop
User Banned
Posted: 14th Jul 2013 19:46
in my app i work like this
i set at startup a temp directory
so now the app is : media\Temp

opentowrite and opentoread are from there.

now when i press the save button
i want to move the new created file

to media\Projects\**PROJECTNAME**-> lastfile created.

this is still in the spectrum of the app and not outside of it.

the temp file is called temp.fle
and when i save i want to rename it to projectname.fle inside the new project folder.

is this possible? or am i completly wrong? cause i think i can but i have no RenameFile(oldName,newName) or CopyFile(oldFile,newFile) when i can address a path if its relative or absoulut ...

so i wonder how can i do this ...

i am now trying with Zip files , where i can compress a file and assign a directory to it and then exctract it with its directory but still it will be in the temp folder which is what i dont want.

any idea?...

ive also thought about creating a function



but in this case i dont know if it will work flawlesly or will it add errors and mem leaks..
so im kinda lost in the mist here...

and also i dont understand why cant i use more folders inside the app WriteFolder... or can i ... i might missunderstood the help files..

:/ i am actually very very upset with TGC team about not having the fundamental CopyFile(old,new) and RenameFile(old,new)...

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Jul 2013 22:16
There are no file rename functions for Tier 1. Your basic function looks fine (as long as the input file is pure text written with WriteLine).

Why not create the initial file with the name and path you would be copying the temp file to. Then, if you decide it does not need to be kept, you can use the DeleteFile command to remove it.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
haliop
User Banned
Posted: 14th Jul 2013 23:51
found a fix for it...

this is what i do: its kinda not the right way to do it but it works pretty fast and everthing is awesome.


after the temp file is done. pressing save , entering a new project name and then

i go from the start of the temp file

reading , saving to vars
setting the projects\newproject folders
copying the entire temp file into the the new project file

the next time i'll Load it will set folder to the new folders
and walla..
if i'll press new it will return to the temp folder and start all over again

.... working great so far but needs more testing.
and i dont use strings at all since they take too much in size and memory.. , integers, bytes and floats thats it.

so if in the temp file

i do
writebyte
writeinteger
writefloat
writefloat
writeinteger

and so on

i will do the same for the new project file

read byte
read integer
read float
read float
read integer

then write in the same way to the new file
write byte
writeinteger
writefloat
writefloat
writeinteger

and it works. ty for your time.

fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 15th Jul 2013 01:04
Quote: ":/ i am actually very very upset with TGC team about not having the fundamental CopyFile(old,new) and RenameFile(old,new)..."

Rename has been on the feature request list for over a year so Paul is aware of the issue.

http://code.google.com/p/agk/issues/detail?id=356&start=100

haliop
User Banned
Posted: 15th Jul 2013 01:35
yeah if it was already in i wouldnot spend a few hours thinking how to do it...
but after all i just learned some cool stuff. so thank you paul for not putting it yet... but please if you read this , please make your best effort to complete atlease the essential for AAA games on mobile devices.

these mostly consirn about
Shaders
File IN/out - we need more and more commands
for example i would like a command that i can read just a line but not call alot of read commands before it until i get it ...
like ReadLine(fileId,LineNum) so lineNum is like 1000 and it reads just that ..
Extensive MEMBLOCKS commands
and ofcourse!!!! how much of FREE RAM is the current device have! it is super important!!!!

Login to post a reply

Server time is: 2024-11-24 18:22:04
Your offset time is: 2024-11-24 18:22:04