Possibility to have last three temp unzips rather than yes or no

Potts43

New member
RL Member
Whilst doing some testing with games that use the temp location to unzip larger games I wondered if it would be possible to have RL allow the last 3 games per system saved. That way you could do testing without having to turn on or off keep temp files. It would prevent having a mass build up of unzipped games but speed up loading of the last most frequently used games. The deletion would be on a rolling 3 or however many games the user wanted to keep. Perhaps allow the user to state that number in RLUI.

Thanks
 

bleasby

RocketLauncher Developer
Developer
You could probably easily create a script that checks your temp folder for the folder creation dates and deletes the older ones.
just add it then to the user functions and you have your new feature checking for that every time you run a new game.
 

Potts43

New member
RL Member
You could probably easily create a script that checks your temp folder for the folder creation dates and deletes the older ones.
just add it then to the user functions and you have your new feature checking for that every time you run a new game.

I'm not sure I could do this easily but I'll try at least. Would this be on a blanket delete or per system basis like that?
I.e. If I ran 4games from 4 different systems it would delete the 1st. Again not what I was thinking....

Also if it was on a date basis then it's not quite how I prescribed. I was hoping to keep the last 3 or so undeleted and when I load a 4th game the oldest one is deleted.

I'll search the web for examples. Cheers
 

Potts43

New member
RL Member
Think I may have sorted the ahk script to enable exactly what I needed. Going to test tomorrow before posting.
 

Potts43

New member
RL Member
Waiting for the test results.

Ok finished testing and it works a treat. How it works....

First checks your rocketlauncher/temp/%system% for empty folders and if it finds any deletes them.

Then goes into every %system% and sorts the game named folders into date order.

It counts the total number of games folders and then deletes the oldest ones until there is only the newest 5 remaining.

It runs every time you exit a game.

You can easily change how many you want to retain.

Just going to clean up the script and annotate it for other people to understand....not that it's anything fancy.

Should upload today or tomorrow
 
Last edited:

Potts43

New member
RL Member
Ok,

I have tried and tested this script. Works fine. You must use a Global TempFolder. Paste it in the :

StopGlobalUserFeatures(){
Log("StopGlobalUserFeatures - Starting")
; INSERT CODE HERE

So that it runs everytime you exit a game.

; THIS IS THE START OF TEMP STUFF script-----------------------------------------------------------------------------------------

IniRead, GTPath, .\Settings\Global RocketLauncher.ini, 7z, 7z_Extract_Path ; get global path from Global RocketLauncher.ini
; This top script removes empty folders to start with
SetBatchLines, -1 ; Make the operation run at maximum speed.
path = %GTPath%
folders_deleted = 0
Loop, %Path%\*, 2 ;loop relative folder path
{
currentfolder:=A_LoopFileFullPath
FolderSizeKB = 0
Loop, %CurrentFolder%\*.*, , 1
{
FolderSizeKB += %A_LoopFileSizeKB%
}
;msgbox %CurrentFolder%`n%FolderSizeKB% ;folder sizes
if FolderSizeKB < 5 ;any folder less than 5kb gets deleted.
{
fileremovedir,%CurrentFolder%,1
folders_deleted+=1
}
}

;go to next part for dates

;---------------------------------------------------------------------------------------------------------------------------

total = ;variable to keep tally of number of folders
FileList = ;clear variable
Loop, %Path%\*.*,2 ;loop temp folder
{
{
; create a list of system named folders in temp
folder = %A_LoopFileName%
Sort, folder ; sort the list
}
gameList = ;clear variable
Loop, %Path%\%folder%\*.*,2 ;loop temp path\system name to get list of game folders in each system folder

{
; create a list of those files consisting of the time the file was created and the file name separated by tab
gameList = %gameList%%A_LoopFileTimeCreated%`t%A_LoopFileName%`n
Sort, gameList ; sort the list by time created
total:= A_Index


sleep, 200


if total > 5 ;change this if you want more or less games left undeleted this needs to match the If Name = 5 line below. This means that if there are more than 5 game folders continue
Loop, parse, gameList, `n,`r ;loop through the game folder names

{
if A_LoopField =
continue
StringSplit, FileItem, A_LoopField, %A_Tab% ; Split the list items into two parts at the tab character
If not ErrorLevel
sleep, 200
{
Name := total - A_Index ; Name = total number of games - the number of loop

sleep, 200
fileremovedir,%Path%\%folder%\%FileItem2%,1 ; delete the game folder
}
If Name = 5 ;change this if you want more or less games left undeleted - This leaves 5 games per system undeleted (Stops the loop at 5 as the loop counts down until there is only 5 left)
break ;stop looping
}
}
}


return ; do nothing we're done

; THIS IS THE END OF TEMP STUFF script-----------------------------------------------------------------------------------------
 
Last edited:

Potts43

New member
RL Member
Forgot to mention that you paste this into the User Functions.ahk which is in the Rocketlauncher/libs folder.
 

gigapig

Member
RL Member
Do you need to explain where exactly to place this? From what I see I could paste it at the end of what is already there or paste it after where is says " ; INSERT CODE HERE" and maybe this needs to be at the end everytime? " Log("StopGlobalUserFeatures - Ending")
}"

Sorry I can't get on the wiki at the moment to check.
 

Potts43

New member
RL Member
Mate check #9

Just paste at paste here in stop global....as we want it to run at the end not before we run the game
 

Ninja2bseen

Member
RL Member
Not yet but I think in rl you should be able to do 1,2,3 option. I want to see if brolly or djvj agrees before I do the install
 

Potts43

New member
RL Member
Not yet but I think in rl you should be able to do 1,2,3 option. I want to see if brolly or djvj agrees before I do the install

It's a 1 minute job to add the script to User Functions.ahk and less to remove it. So why not try it[emoji14]
 

brolly

Administrator
Developer
We can look into adding this to RL if there's enough interest, will need to have a better look at the code and will probably need a few more customizations, for example appending %system% to the temp name is a RL setting so if this were to be added officially we would need to consider both scenarios.
But this probably won't happen soon so I'd suggest you to go ahead and add it to User Functions if you are interested to use it. Besides that will also be the only way to to help out potts find any possible bugs.

Nice to see people making good use of User Functions, this is the reason we added those in the first place to give users a lot of flexibility to what they can do with RL.
 

Potts43

New member
RL Member
We can look into adding this to RL if there's enough interest, will need to have a better look at the code and will probably need a few more customizations, for example appending %system% to the temp name is a RL setting so if this were to be added officially we would need to consider both scenarios.
But this probably won't happen soon so I'd suggest you to go ahead and add it to User Functions if you are interested to use it. Besides that will also be the only way to to help out potts find any possible bugs.

Nice to see people making good use of User Functions, this is the reason we added those in the first place to give users a lot of flexibility to what they can do with RL.

I'm just a regular user who needed this option so worked through some code until it worked . I've not found any issues with my code but I'm sure it can be refined by you guys. I just figured I'd share it with everyone.
 

bleasby

RocketLauncher Developer
Developer
Sertting the amount of extracted games to keep globaly or at a system level is now supported by RL. Read the changelog and the respective RLUI tooltip to know more about it.
 
Top