Is there a portable version of Twine? Or can I change the Stories directory?

+1 vote
asked Aug 11 by Wagemage (140 points)
I've been seeing this question bubbling around the forums for literal years. I thought surely someone would have resolved it by now.

I work at a lot of different computer labs throughout the day. I keep my personal stuff on portable storage. I would really rather not leave my work laying around on every machine I log into. The web version is no help as it only saves to that local drive.

All it would take is the option to point the "Stories" directory to a specific place. I know I'm asking unpaid programmers to make a change to a piece of free software, but this doesn't seem like it would be that hard. The directory is defined in the code. Just give me a button to change that variable. You already have the ability to access the file system (import from file). Would it be that hard to give us a settings option to move the Stories directory?

Am I missing something? Do I need to learn C++ just to make this change?

2 Answers

0 votes
answered Aug 11 by Liamw104 (2,290 points)
Assuming that you are on the windows version of twine.

You can go to the twine folder then copy it into your portable storage device then copy twine itself onto the portable storage device and It should work.


Edit: it works the same way on macOS as well.
commented Aug 11 by Wagemage (140 points)
That is how I have it set up now. It still creates a local Stories dir.
+2 votes
answered Aug 11 by greyelf (20,630 points)

As far as I know the issue of being able to selectively select where story Project HTML files are stored when using the install-able release of the Twine 2 application has not been resolved yet.

A little technical background.  

The install-able release of the Twine 2 application itself will run from a remove-able storage device like an external hard-drive or a thumb-drive. The issue is how the install-able release determines the location/folder of the story Project HTML files.

1. How the story Project HTML file location is determined.

Based on the code in the Twine 2 project's twinejs/src/nw/directories.js file it uses the osenv.home() function to determine the base path of location the files will be stored in, it then appends to that base either "Documents" or "My Documents" (in the relevant language of the end-user) to determine the documents path, and it finally appends the equivalent of "Twine\Stories" to the documents path to obtain the location of the project files.

2. How the osenv.home() function determines the base location.

Based on the code in osenv project's osenv/osenv.js file it uses the osHomedir() function derived from the os-homedir project to determine the home location.

3. How does the osHomedir() function determine the home location.

Based on the code in the os-homedir project's os-homedir/index.js file there is a hierarchy used to determine the home location, and this is where things become a little complex because the hierarchy depends on things like which Operating System (and version of the OS) the end-user is using and how they have the environment of their OS setup.

Basically it is based on a set of Environment Variables which store the paths to folders, each of these Environment Variables may not exist which is why the code uses a hierarchy, and if none of the Environment Variables exist then the folder the Twine 2 application is being run from is determined to be the home location.

4. If you temporary override the value of first Environment Variable checked for your particular OS then you can force the Twine 2 application to use a different home location, which in turn will influence which "Documents\Twine\Stories" folder (in the relevant language of the end-user) is used to store the story Project HTML files. How you do this depends on the OS being run.

commented Aug 11 by Wagemage (140 points)
Thanks for the detailed response. I'm not sure I know how to do what you suggest but this guidance would help me find out.

In this context I'm forced to wonder why twine doesn't just ask for the home dir and prepopulate with the one it thinks is right. That doesn't seem a bridge too far.
commented Aug 11 by greyelf (20,630 points)

This Issue has been visited a couple of times in the past (one example is #108) unfortunately at the time the Twine 2 code base was going through a re-design / re-write and it hasn't been revisited since then.

The final solution needs to support multiple operating systems as well as allowing the web-browser based release to keep working as it currently does.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.