TeXworks / texworks

Main codebase for TeXworks, a simple interface for working with TeX documents
https://tug.org/texworks/
GNU General Public License v2.0
698 stars 127 forks source link

Feature request: portable operation #95

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Portable software has recently become really popular as people like to 
take their applications with them wherever they go. Please, consider 
making texworks a portable application (i.e. able to run entirely from 
USB stick without leaving anything behind on the host computer). This 
means there should be a possibility to configure the location of user 
settings and storage of configuration data in e.g. ini files rather than 
registry (Windows registry is regarded by many as evil).

Tomek

Original issue reported on code.google.com by t34...@googlemail.com on 26 Dec 2008 at 1:54

GoogleCodeExporter commented 9 years ago
The attached patch should implement this feature.

If you create a file named "portable.ini" in the TeXworks application directory 
which
includes the statements inipath = ... and/or libpath = ... those directories 
will be
used for storing configuration files and/or library data (templates etc.),
respectively. The following is a very simple example:
inipath = ./portable/
libpath = ./portable/

Note that the directories given must exist. If you use relative directories they
should be relative to the TeXworks application directory no matter which 
directory
the program is run from. Be careful when using symbolic links under *nix, 
though.

I hope those two things are the only ones in the way of portable operation.

Original comment by st.loeffler on 27 Dec 2008 at 2:08

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for making those changes so promptly.

Tomek

Original comment by t34...@googlemail.com on 27 Dec 2008 at 6:57

GoogleCodeExporter commented 9 years ago
No problem. Note that it's not in the subversion repository yet, Jonathan has 
the
final call regarding that. You can use it in your local version though 
(assuming you
build TeXworks yourself) by applying the patch to your source (on *nix-ish 
systems
you could use the "patch" command line tool).

Note also that I only tested it quickly on Linux (Ubuntu 8.10).

Original comment by st.loeffler on 27 Dec 2008 at 7:06

GoogleCodeExporter commented 9 years ago
There has been a little bug in the previous patch. Please disregard it and use 
the
one attached to this comment instead.

The application behaved incorrectly if a non-existent path was given in the
portable.ini file (instead of disregarding it it used the application 
directory).

Sorry
Stefan

Original comment by st.loeffler on 28 Dec 2008 at 8:28

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion and patch! :) This looks like a reasonable thing to 
do; I will try to test it on other 
platforms shortly, but at a glance it looks like it should be fine.

I just wonder about the name chosen for the file; would it be good to include 
"TeXworks" or "TW" in the name, 
e.g., "texworks-portable.ini" or "twportable.ini" or something like that? Or 
even just "texworks.ini"?

Original comment by jfkth...@gmail.com on 28 Dec 2008 at 9:46

GoogleCodeExporter commented 9 years ago
The first two suggestions sound fine. I had thought about calling it 
texworks.ini but
eventually decided against it because I assumed that most users would expect 
such a
file to hold all TeXworks configuration options rather than just some 
portability
stuff (at least that's the common behavior on Windows, I think). So putting
"portable" (or something similar) in the file name seems to me like a good idea 
to
get it straight that this is only about portable operation.

Original comment by st.loeffler on 29 Dec 2008 at 9:45

GoogleCodeExporter commented 9 years ago
I have committed this patch (using the filename "texworks-portable.ini" for 
clarity; we don't run on old systems 
that are limited to 8.3 filenames anyway!) .... many thanks, Stefan. Not yet 
built and tested on Windows.

Original comment by jfkth...@gmail.com on 4 Jan 2009 at 1:03

GoogleCodeExporter commented 9 years ago
Patch broke QT < 4.4 compatibility (QSettings:setDefaultFormat was introduced in
4.4). The attached patch should disable portability for older QT releases.

(Reported by Martin Sievers on the mailing list)

Original comment by st.loeffler on 7 Jan 2009 at 6:15

Attachments:

GoogleCodeExporter commented 9 years ago
I'm attaching an alternative patch that attempts to modify the usage of 
QSettings so that "portable" mode can 
still be used with older Qt versions. I have not had time to test this on 
various systems, so am not checking in 
the changes yet, but would appreciate hearing whether this works (builds OK, 
and portable mode behaves 
correctly) for people.

Note that to try this, you should apply this patch to the current SVN sources 
*instead of* Stefan's patch (above); 
don't use both at once.

Original comment by jfkth...@gmail.com on 8 Jan 2009 at 4:06

Attachments:

GoogleCodeExporter commented 9 years ago
OK I did compile v.271 applying the patches given by Jonathan.
*It works* (Windows XP SP3). For Qt I don't know the version, it should be 4.4 
as I
downloaded the KDE system mid-january!!

I just have a question: in the first message of Stefan, he writes:
.../... the statements inipath = ... and/or libpath = ... those directories 
will be
used for storing configuration files and/or library data (templates etc.),
respectively. The following is a very simple example:
inipath = ./portable/
libpath = ./portable/

I think the configuration files and the libraries (templates) are in the same,
automatically created, directory; normally in (for Windows) c:\Documents and
Settings\<user>\TeXworks.
I had to put both with the new target:
inipath = c:/adel/TeXworks/
libpath = c:/adel/TeXworks/
The program itself is in c:\Program Files\TeXworks, together with the .dll and 
the
texworks-portable.ini (and a tentative icon :-)) ).
And the configuration of the editor (font...) was not maintained, as well as 
the list
of recent files; they had to be recreated!!

Or should I specify the corresponding subdirectories of c:/adel/TeXworks/?

Also, if I decide, for an USBkey, to put the configuration subdirectories in the
program directory, what should I specify?

Original comment by lal.stu...@yahoo.fr on 14 Feb 2009 at 4:27

GoogleCodeExporter commented 9 years ago
config and library files and do get created in the same folder (and its 
subfolders)
on Windows by default. This doesn't necessarily is true for all OSs (Mac puts
libraries in a special folder, I think, and on *nix some spelling dictionaries
(=libraries) are located in system paths). In any case users may want to use 
their
personal configuration (ini) while working with the libraries on the computer 
they
are currently working on (i.e. to use different templates at home, at work, 
etc.).
That's the reason why the two different statements exist.
Hence you have to use both statements to get fully self-contained operation. 
They can
both point to the same directory (as given in the example). Note that in the 
library
directory some sub-folders will be created.
As stated above if relative paths are given they are taken to be relative to the
application's directory. So in order to put everything directly in that folder 
just
specify
inipath = ./
libpath = ./

Note that I'd personally *discourage* this behavior as it clutters that folder.
Instead, I'd suggest creating a subdirectory (in the example called "portable") 
for
putting all config/library files in. That way those files can easily be shared 
with
others (just copy the folder).

This also leads to the answer to your statement that the configuration was not
maintained. If you create the "portable.ini" file and want to retain your
configuration you have to copy your original configuration file to the new 
location
manually (as soon as TeXworks finds the portable.ini file it follows the rules 
set
there and doesn't check any other directories).

HTH
Stefan

Original comment by st.loeffler on 17 Feb 2009 at 8:24

GoogleCodeExporter commented 9 years ago
I would like to thank again for adding this "portable mode" feature to 
texworks. 
Would it be possible to extend it further and provide command line options:

--inipath path/to/ini
--libpath path/to/lib

This would be useful for integrating and running texworks from non-writeable 
media.

And one more question: can entries in texworks-portable.ini contain 
environmental 
variables?

Tomek

Original comment by t34...@googlemail.com on 27 Feb 2009 at 7:13

GoogleCodeExporter commented 9 years ago
@command line options:
I think that's a good idea. TeXworks doesn't parse the command line 
extensively, yet,
so this isn't so easy to implement. But I've added issue 113 so this hopefully 
gets
implemented in the future.

@environmental variables:
AFAIK Qt doesn't currently support expansion of those variables, unfortunately. 
I
guess it's not so easy to do cross-platform-wise. In any case you could try if 
it
works on your system.

Stefan

Original comment by st.loeffler on 5 Mar 2009 at 3:10

GoogleCodeExporter commented 9 years ago
Just to note: the "portable-mode" configuration file has just been renamed (in 
r.285) to "texworks-setup.ini"; see 
recent mailing-list discussion re configuring the default binary paths.

Use of this file to provide "portable" operation should be unaffected, you'll 
just need to rename it.

Original comment by jfkth...@gmail.com on 16 Mar 2009 at 2:39