1252 ObjectPAL: Alias setup for an application
VERSIONS: All
SUBJECT: Advice on Alias setup
BY: STEVE CAPLE
Date: 6 October 1999

I generally put the tables in the main app directory, with subdirectories for forms, reports, libraries. The relative directory structure below the app directory must be the same in any installation.

I define PROJECT (not public) aliases in a startup script called from the desktop icon (see command line options).

Here's a bit of code - this is run in the main app directory as the working directory, and the aliases for forms, reports, libraries, are set relative to the working directory. Working directory can also be set from the command line.
Proc uEstablishProjectAlias(
   var tc tCursor,
   const stAlias string,
   const stPath string)

if tc.locate("DBName",stAlias) then
   if tc."DBPath" <> workingDir() then
      if not setAliasPath( stAlias, stPath ) then
         errorShow("Problem: setAliasPath "+stAlias+" to "+stPath)
         return
      endif
   endif
else
   if not addProjectAlias( stAlias, "STANDARD", stPath ) then
      errorshow("Problem: addProjectAlias "+stAlias+" to "+stPath)
      return
   endif
endif
endProc


method run(var eventInfo Event)
var
   app         application
   tc          tCursor
   stAlias,
   stPath      string
   x,y,w,h     longInt
   fPW,
   fApp,
   f           form
   lgDev       logical
   mnuMain     menu
endvar

menuAction(MenuWindowCloseAll)
mnuMain.empty()
mnuMain.addtext(" ")
mnuMain.show()

setDesktopPreference(PrefProjectSection, prefTitleName,"JRW  -  database logon")

delayScreenUpdates(YES)
hideToolBar()
projectViewerClose()
;app.maximize()

enumAliasNames(":PRIV:__ALIASES.DB")
tc.open(":PRIV:__ALIASES.DB")

stAlias = "JRW"
stPath = workingDir()
uEstablishProjectAlias(tc, stAlias, stPath)

stAlias = "FORMS"
stAlias = "FORMS"
stPath = workingDir()+"\\FORMS"
uEstablishProjectAlias(tc, stAlias, stPath)

stAlias = "REPS"
stPath = workingDir()+"\\REPORTS"
uEstablishProjectAlias(tc, stAlias, stPath)

stAlias = "HELP"
stPath = workingDir()+"\\HELP"
uEstablishProjectAlias(tc, stAlias, stPath)

stAlias = "LIBS"
stPath = workingDir()+"\\LIBRARIES"
uEstablishProjectAlias(tc, stAlias, stPath)

...............

endMethod

To index