Now that I regularly use source control for my projects, it’s convenient. I love being able to back stuff up. But I’ve had this question for a while:
Most of my files, I can provide a symbolic link and update either my non-Github or Github copy when editing at will. The original copy is in the Github directory, and the linked copy is in c:\games\inform\etc.
But if I use the Inform IDE, and I save the link version of the story.ni file and build, it becomes an unlinked file.
This makes it a small hassle to make further changes and copy story.ni back over. That’s okay, as I can always just do things manually, and I should always check source before committing it anyway…and I can always use a pre-commit hook to check the games\inform vs github versions as well!
But I’m wondering if there is a workaround, and if not, what is the explanation?
The Windows front end uses a fairly standard pattern for saving that avoids the risk of an error leaving the user with no source file: when you save a new file, “source.ni.save” is created. Only once that has been successfully saved to is the old “source.ni” deleted, and “source.ni.save” renamed to “source.ni”. That will have the side effect of removing your link.
Thanks for the quick response! That sounds like a really good safety precaution. I have an easy workaround to resync the games\inform file and the github file, so I’m not too concerned.
There is, though, a solid workaround! This only happens when the
story.ni file itself is a symlink: I just make the whole directory a symlink instead, then use a
.gitignore to keep the other files from clogging up version control.
That makes a lot of sense! It’s one I thought of before, but it wouldn’t be trivial for me, because I have a lot of perl and python files in the story.ni directory that go to the utils\ subdirectory. And right now I also put a bunch of other files into the top level directory.
I suppose maybe it’s time to organize my directory structures a bit better. It’s been something I’ve been thinking about for a while, and right now it’s pretty much
(all source/walkthrough/map files at top level)
(all python/perl utilities specific to the project in utils)
I always felt story.ni should be at the top level, since it is sort of the centerpiece of the whole repository. But it doesn’t really need to be, since more commits than not have changes in story.ni. And come to think of it, there’s no rule that a directory with just 1 file in it is somehow wasteful. Or if there is, this is a relatively good time to break that rule.
If you’re using Git (or any other source code system) I’d recommend going up a level so you can include files from both the .inform and .materials folders. Using project local extensions makes it much easier to reliably build projects, even if it’s just yourself doing it in a few month’s time.