This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Portable Calligra on Windows

Tags: None
(comma "," separated)
Stephen Leibowitz
Registered Member
Posts
54
Karma
0

Portable Calligra on Windows

Tue Dec 25, 2012 11:58 pm
I am using the Windows version of Calligra 2.5.4. This post outlines what I have done to adapt it for portable use, such as on a thumb drive.

First, I ran the installation program (MSI file), which installed Calligra on my Win XP hard drive. I then copied the application folder Program Files\Calligra to a thumb drive. The folder has a file named Env.bat. It seems that this was meant to facilitate portable use, but the following line needs to be changed:
set KDEHOME=%USERPROFILE%\AppData\Roaming\.calligra

I made a copy of Env.bat named Portable.bat, in which I changed the above line to:
set KDEHOME=%~d0\AppData\Roaming\.calligra

%~d0 is a batch modifier. Here is the link to a page titled, Using batch parameters:
http://looooj.github.io/blog/2014/02/28/batch-parameters.html

I also copied the subfolder AppData\Roaming\.calligra from the Documents and Settings folder on my XP hard drive to the root of the thumb drive. An alternative would have been to copy it to inside the Calligra folder on my thumb drive, with the corresponding adjustment to the set KDEHOME.

Questions to the provider of the Windows installer: Why is there a Roaming folder? Why not have .calligra directly underneath AppData?

On my thumb drive, I use a portable program launcher called PStart. It has path portability, which means it uses automatic relative paths (e.g. ..\..\personal\work.doc). When a program is on the same drive as PStart, it is not necessary to specify its drive letter to PStart. This is useful for thumb drives, as the drive letter may vary. Here is a set of menu item properties to run Calligra Words from PStart:

Name: Calligra Words
Application path: \Program Files\Calligra\Portable.bat
Command line parameters: bin\CalligraWords.exe
Home directory: \Program Files\Calligra

PStart is also capable of setting environment variables for the duration of a program. We can dispense with using a batch file. This eliminates the console window that it would open:

Name: Calligra Words
Application path: \Program Files\Calligra\bin\CalligraWords.exe
Home directory: \Program Files\Calligra
Environment: KDEHOME=\AppData\Roaming\.calligra
Environment: KDEDIRS=\Program Files\Calligra
Environment: PATH=\Program Files\Calligra\bin;
\Program Files\Calligra\lib;
\Program Files\Calligra\lib\kde4;%PATH%

A batch file could be used instead of a portable program launcher. Here is a short file that I named CWords.bat:
Code: Select all
%~d0
cd \Program Files\Calligra
Call Portable.bat  bin\CalligraWords.exe


For PowerShell users, there is the StartApp.vbs file in the Calligra folder. It can be changed to run Portable.bat instead of Env.bat.

There is at least one potential problem. The Windows version of Calligra requires the runtime libraries msvcp100.dll and msvcr100.dll. The Calligra installer will install these libraries in the Windows\System32 folder (on Win XP). But it is a hit-or-miss proposition that they will be on other systems that you connect your thumb drive to, particularly systems running XP. Microsoft discusses a solution at
http://msdn.microsoft.com/en-us/library/vstudio/ms235299.aspx
“… you can directly install specific Visual C++ DLLs to the application local folder. An application local folder is a folder that contains an executable application file.”

So you can copy the two DLL files from the Windows\System32 folder to the Calligra\bin folder on the thumb drive. An alternative source for these two DLL files is
http://www.portablefreeware.com/resources.php

After the portable version of Calligra is set up on the thumb drive, you may uninstall the regular version from the hard drive.

Here is an outline of the folders and files on my thumb drive:
Code: Select all
  PStart.exe (optional portable program launcher)
   AppData\Roaming\.calligra
   Batch Files
      CWords.bat
      (batch files to run other Calligra applications)
   Program Files
      Calligra
         Portable.bat (derived from Env.bat)
         StartApp.vbs
            bin
               msvcp100.dll
               msvcr100.dll
         (other files)


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], mesutakcan, Sogou [Bot]