DaloLorn / Rising-Stars

A large-scale mod for Star Ruler 2.
http://steamcommunity.com/sharedfiles/filedetails/?id=812827373
Other
18 stars 7 forks source link

Did you know? Subfolders and load times... #20

Closed darloth closed 8 years ago

darloth commented 8 years ago

If you put your mod in a subfolder, with the .git folder at the TOP level, you can then use a symbolic link to get it as a local repository without ever having any of the .git stuff touch the actual mod folder in the Star Ruler 2/mods folder.

That means you can accumulate all of the various changes without SR2 taking ages to load because .git stores chunks of the project history as hashes in there.

I realize that now is not the -ideal- time to suggest this, but it's the best time there will ever be from now forwards, as it's only going to get more annoying to re-directory it in future.

Here's an example: Example image

that shortcut looking thing is actually a symbolic link, so from git's perspective, everything in the Building Assortment folder is a subfolder of the SR2-BuildingAssortment folder in my SourceControl folder.

Meanwhile, the Building Assortment folder is actually/simultaneously at steam/blah/Star Ruler 2/mods/Building Assortment, so I physically cannot accidentally upload my .git to the steam workshop because it's not in the folder tree that SR2 can actually see.

I tried to set this up for my local copy of Rising-Star, but it won't work without the subfolder.
Do you think it's a worthwhile idea? Having investigated, there IS a way to convince Git to do this and maintain file histories, it will be treated as if every file in the entire repo has been renamed (to include the longer file path). If we are very careful to have a clean, easy master before we go renaming everything, and as long as that rename is the ONLY change in that commit, it should be quite plausible to do this merge without breaking anything.

What do you think?

^_^ eheh...

DaloLorn commented 8 years ago

Uuuuuh... I guess. I'm not quite sure... scratches head semi-confusedly

darloth commented 8 years ago

Doesn't it annoy you that the .git folder shows up in the SR2 mod editor?

Wouldn't you like it to just keep out of your way? :) If so, then Support Proposal #20 Today!

DaloLorn commented 8 years ago

Heh, I dealt with that particular issue in the (now-broken) modding toolkit.

Anyway, I'm mostly unsure about the technical details of the implementation (as in, 'what the hell is he talking about' - I'm probably only around 90% sure I figured it out), not whether it's worth doing.

DaloLorn commented 8 years ago

Tried it with a soft link. Not only did it insist that every file had been deleted and replaced (rather than renamed), it also failed to stage the files because of the symlink (for whatever reason). :/

darloth commented 8 years ago

mklink /J "%repoPath%\%modName%" "X:\Steam\steamapps\common\Star Ruler 2\mods\%modName%" is the command I use, with appropriate variables filled in obviously.

Were you using Junction? It's the only one that's transparent to file systems and things.

I'll have a go myself at some point.

DaloLorn commented 8 years ago

Ahh, junctions. I'll try that next time - I went with /D.

DaloLorn commented 8 years ago

AAAAAAAARGH.

Stupid Git client marked it as a 'rename' and then just 'added' the damn thing. (And to add insult to injury, it didn't 'remove' the old files!)

Alarcarr commented 8 years ago

Thing is ,git is not slowing the loads (to the point to the 60s compile )I already tryed deleting the git folder when the mod was slow.And did not improve. Only removing all the content and cloning again fixed it.

pd:hope i am wrong tho.But i still think that moving files around is what fixed it.

DaloLorn commented 8 years ago

I suggest you call your mod folder 'ABEM', but symlink it into 'Rising Stars'. That way, when you edit locale files, you'll edit the ABEM_%stuff% locale files instead of creating a new one.

darloth commented 8 years ago

Alas, no, it won't work that way :) Star Ruler 2 will still see it as Rising Stars, so it'll use those locale files. It's only Git that will see it as ABEM, and that won't help all that much. Since the mod is literally called Rising Stars, SR2 is always going to see it that way - it's in the mod info :)

On the plus side that makes all the stuff I write nicely collated together, and you or I can just merge them into the main ones whenever you or I feel it appropriate.

DaloLorn commented 8 years ago

Nope, it's not the modinfo. I know from experience - I've had 'ABEM', 'ABEMGit', 'ABEMGitNew', and whatever folder names Alar came up with.

If your mod folder is called 'ABEM', SR2 will use ABEM%stuff%. If your folder is called 'Rising Stars', which it apparently is, SR2 will use 'Rising Stars%stuff%' - as it already has for you.

darloth commented 8 years ago

Huh. Well, fair enough, but... if we're renaming the project to Rising Stars sly grin why don't we just rename all the locale files too? (Sorry, sorry! ^_^)

Dalo: Because. :P

darloth commented 8 years ago

Oh right. I had a more useful comment. Here are the steps for someone new to clone the repo and set up the symbolic junction link. (And yes, if you're wondering I still think of final fantasy 8 every time I use one.)

  1. Prepare a folder you'd like to keep your source control stuff in. Create it but keep it empty. For me this is "X:\Projects\SourceControl\SR2-Rising Stars"
  2. Using your git client of choice or the git command line, clone the online repository from https://github.com/Alarcarr/Rising-Star selecting your local destination. For me this would be "X:\Projects\SourceControl\SR2-Rising Stars" as the local destination.
  3. It will create a .git folder, readme.md, a few other git files and also a subfolder called "Rising Stars".
  4. Close your git client, then cut that entire directory to the clipboard. Paste it to your Star Ruler 2 mods directory, for me that is "X:\Steam\steamapps\common\Star Ruler 2\mods".
  5. Open a command prompt (possibly an admin command prompt, especially if anything in your paths involves Program Files) and navigate to the place you just cut-and-paste the directory from. Enter the following: mklink /J "Rising Stars" "{Path to your mod folder}\Rising Stars"

For me, using these examples, the entire line including the command prompt location is: X:\Projects\Sourcecontrol\SR2-RisingStars>mklink /J "Rising Stars" "X:\Steam\steamapps\common\Star Ruler 2\mods\Rising Stars"

After performing all of these steps, reload your git client and it should work as normal, but you won't be bothered by .git files getting into the SR2 mod editor, and neither is there any possibility they'll be uploaded to steam.

DaloLorn commented 4 years ago

Linux users: Instead of the syntax mklink /J %SOURCE% %DESTINATION% used by Darloth's guide, you will need to use sudo mount --bind %SOURCE% %DESTINATION%. Per Skeletonxf/star-ruler-2-mod-ce#1, this will need to be repeated on every reboot. One way to do so is to schedule a CRON job to run every reboot (originally contributed by @Skeletonxf):

A good cross distro solution is to add a line to your root crontab

sudo crontab -e opens the crontab

Add in @reboot mount --bind %SOURCE% %DESTINATION% (no sudo is used because this runs as root anyway)

If you get prompted to choose an editor pick nano and if that isn't available pick whatever isn't vim.