Separating User data from J program installation for J6.01

Introduction

Note that the contents of this page refer to J6.01. Significant improvements were made to the J6.02 install routines that now make customising installs much easier - see System/Installation.

Objectives and reasons

Why?

Caveats

The ideas below are from my own limited experience (and expertise) and my reading of the forum and J help. I haven’t tested all the all ideas discussed below, and those that I have tested were only tested on Windows XP SP2 - so use the suggestions at your own risk!

I’m not sure how “supported” any of these configurations are by JSoftware. There may well be issues that I’m not aware of that mean the following suggested configurations are “a bad idea”. In which case it may be best to delete this page!

The following comment from Eric Iverson, in a discussion about this topic, suggests that it might be a good idea to wait for J6.02 before tackling this problem.

from     Eric Iverson <eiverson@sympatico.ca> Jun 21 
to       General forum <general@jsoftware.com>   
date     Jun 21, 2007 9:22 AM    
subject  Re: [Jgeneral] Profile.ijs comments

There are some changes in 602 in installs and how the
JFE/JE/profile/standard library interact. I hope to get a preliminary beta
out by the end of next week. You might consider putting more effort in this
area on hold until you have the new version to work against.

Please feel free to edit this guide or add comments/suggestions/improvements/disagreement.

Approach

The code changes to profile.ijs are the same wherever it is located. There are three suggested locations for the profile.ijs:

  1. the default location of the profile.ijs in the J installation folder or,

  2. a sub-folder of the J installation e.g. \j601\user\config\profile.ijs

  3. a sub-folder of the users' data store e.g. \My Documents\Jcode\config\profile.ijs.

Pros and Cons

Each option has its advantages and disadvantages:

Implementation

Assumptions

Locations

the default location in the J installation

  1. Make a copy of the original C:\Program Files\j601\profile.ijs so that you can restore it if need be.
  2. Edit C:\Program Files\j601\profile.ijs as detailed below

sub-folder of the J installation

  1. Copy C:\Program Files\j601\profile.ijs to C:\Program Files\j601\user\config\profile.ijs

  2. Edit C:\Program Files\j601\user\config\profile.ijs as detailed below

The command line for the shortcut to put in \Documents and Settings\All Users\Start Menu\Programs\J is:

"C:\Program Files\j601\j.exe" -jprofile "C:\Program Files\j601\user\config\profile.ijs"

sub-folder of each user's data store

  1. Make a copy of C:\Program Files\j601\profile.ijs for editing

  2. Edit profile.ijs as detailed below

  3. Copy the edited file to \My Documents\Jcode\config\profile.ijs for every user

The command line for the shortcut to put in \Documents and Settings\All Users\Start Menu\Programs\J is:

"C:\Program Files\j601\j.exe" -jprofile "%USERPROFILE%\My Documents\Jcode\config\profile.ijs"

Changes to profile.ijs file

«profile.ijs»= unchanged
NB. =========================================================
NB. various global definitions
NB.
NB. Here, verb jhostpath converts between path separators / and \
NB. as required by the host system. For example, under Windows:
NB.       jhostpath 'system/main/dates.ijs'
NB.    system\main\dates.ijs
3 : 0 ''
notdef=. 0: ~: 4!:0 @ <
if. notdef 'ARGV' do. ARGV_z_=: ,<'undefined' end.
if. notdef 'PROFILE' do. PROFILE_z_=: 1!:45'' end.
PATHSEP_j_=: '/\'{~6=9!:12''
jhostpath_z_=: PATHSEP_j_ & (I. @ (e.&'/\')@] })
''
)

NB. =========================================================
NB. create SYSTEMFOLDERS
NB. the entry for binary is added in boot.ijs
sep=. PATHSEP_j_
prf=. PROFILE   {.~ PROFILE   i: sep
add=. prf,sep,'addons'
sys=. prf,sep,'system'
hlp=. sys,sep,'extras',sep,'help'

«profile.ijs»= old definitions commented out
NB. tmp=.prf,sep,'temp'
NB. usr=.prf,sep,'user'
NB. cfg=.usr,sep,'config'

«profile.ijs»= new definitions for user folders
usrdata=. (2!:5 'USERPROFILE'),sep,'My Documents'
NB. usrdata=. (2!:5 'HOMEDRIVE'),(2!:5 'HOMEPATH'),sep,'My Documents'  
usr=. usrdata,sep,'Jcode'
tmp=. usr,sep,'temp'
cfg=. usr,sep,'config'

«profile.ijs»= unchanged
hom=. (0&e. { ;&prf) 2!:5 'HOME'
ids=. ;: 'profile system addons temp user config help home'
SYSTEMFOLDERS_j_=: ids ,. prf;sys;add;tmp;usr;cfg;hlp;hom

NB. =========================================================
NB. boot up J:
NB. note: this may load a command line script, and should be
NB. the last entry in this script. Any additions beyond this
NB. point may confuse things and cause failures.
0!:0 <jhostpath sys,'\extras\util\boot.ijs'

Alternative Approach to Customizing "profile.ijs"

The following is how I (Devon) use my own directories for my own code and "temp" area to which the *.ijx session files are saved. This is adapted from the reference * general/2006-October/027969 below.

On investigation, I realized J has a configuration setting that allows me to set "~User" to an arbitrary directory. If I'm disciplined enough to use "~User\" (note the initial upper-case letter) to prefix all calls to my own scripts, I can keep them wherever I want. For example, to load my own statistics functions:

load '~User\code\mystats.ijs'

This allows me to keep my code in an arbitrary directory and not under the horribly named, top-level directory "\Program Files".

After accomplishing this, it occurred to me that I often refer back to old session logs (the *.ijx files that store the contents of a J session) and I'd like to back those up as well. However, the mechanism for doing this is not as apparent as for changing "User".

So, I copied "C:\Program Files\J601\profile.ijs" to my own directory "C:\amisc\JSys" and made the following change to my custom profile:

NB. Use my own temp area....
NB. tmp=. prf,sep,'temp'
tmp=. 'C:',sep,'amisc',sep,'JSys',sep,'temp'

This works fine: now my temp directories default to the directory I specify: 'C:\amisc\JSys\temp' in this case. However, I have to start J with this customization to the command line:

"C:\Program Files\j601\j.exe" -jprofile c:\amisc\JSys\profile.ijs

in order to use my custom profile, but this doesn't seem too onerous.

Note that "-jprofile" avoids loading the standard profile and "c:\amisc\JSys\profile.ijs" is the name of the script to run upon starting J. I mention this because, for a long time, I interpreted the construction

-jprofile FN

to mean "substitute FN for the profile", which is subtly different.

See Also


CategoryWorkInProgress CategoryLiterate

Guides/Custom User Install (last edited 2008-12-08 10:45:46 by )