home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a079 / 1.img / FMW.LZH / FM_LOCAT.PRG < prev    next >
Encoding:
Text File  |  1993-01-23  |  1.4 KB  |  70 lines

  1. FUNCTION FM_LOCAT
  2. if not _windows
  3. **** PRE WINDOWS CODE
  4. =pathset()
  5.  
  6. * returns directory of foxmasters
  7. public fmhome, fm_base
  8. fmhome = ""
  9. IF FILE(SYS(2004)+'fm\'+"FM_setup.DBF")
  10.    =SB_SELEC(SYS(2004)+'fm\',"FM_setup")
  11.    
  12.    GO TOP
  13.   fm_base = sys(2004)+"FM\"
  14.   fmhome = TRIM(FM_setup.location)
  15. endif  
  16. if empty(fmhome)
  17.  
  18.    fmhome = sys(2004)+"FM"
  19.  
  20. endif
  21. * SEE IF  HOMEDIR IS IN THE FOXPRO PATH STATEMENT
  22. else
  23. *************************
  24. *** Windows Code
  25. * Sample program to output to comm port
  26. * uses foxtools library for generic DLL access
  27.  
  28. set library to sys(2004)+"foxtools.fll" additive
  29.  
  30. getprofstr = RegFn("GetProfileString", "CCC@CI", "I")
  31. section = "FoxMasters"
  32. item = "FMPATH"
  33. default = "C:\FM"
  34. fm_home = space(80)
  35. maxsize = 80
  36.  
  37. * returns value by reference
  38. ln =CallFn(getprofstr,section,item,default,@fm_home,maxsize)
  39.  
  40. * get rid of extra spaces and asc 0 at end of path string
  41. fm_home =  left(alltrim(fm_home),len(alltrim(fm_home))-1)
  42.  
  43.  
  44. IF FILE(fm_home+'\'+"FM_setup.DBF")
  45.    =SB_SELEC(fm_home+'\',"FM_setup")
  46.    
  47.    GO TOP
  48.   fm_base =fm_home
  49.   fmhome = TRIM(fm_home)
  50. endif  
  51.  
  52. * release library sys(2004)+"foxtools.fll"
  53.  
  54.  
  55.  
  56. endif
  57. =pathchec(fm_home)
  58.  
  59. RETURN (fm_home) 
  60.  
  61. FUNCTION pathchec
  62. PARAMETERS path2check
  63. private path2check, oldpath, newpath
  64. oldpath = set("path")
  65. if not upper(path2check) $ oldpath
  66.  newpath = path2check+";"+oldpath
  67.  set path to (newpath)
  68. endif
  69. return .t.   
  70.