ossiejhmoore

GetLocationOfThisOSpace

Aug 17th, 2012
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. /*
  2.  
  3. * Determines the the location of the module containing the ospace object.
  4.  
  5. */
  6.  
  7. function Assoc GetLocationOfThisOSpace( Dynamic osObj = Undefined )
  8.  
  9.  
  10.  
  11. Assoc retVal
  12.  
  13. retVal.ok = false
  14.  
  15. retVal.ErrMsg = Undefined
  16.  
  17. retVal.Path = Undefined
  18.  
  19. retVal.File = Undefined
  20.  
  21.  
  22.  
  23. String osName
  24.  
  25. String ollPath
  26.  
  27. String ospaceDir
  28.  
  29. String moduleDir
  30.  
  31. File moduleFile
  32.  
  33.  
  34.  
  35. if (IsUndefined(osObj))
  36.  
  37. retVal.ErrMsg = "Undefined OSpace object passed to GetLocationOfModule"
  38.  
  39. else
  40.  
  41.  
  42.  
  43. ollPath = OS.FileSpec( osObj )
  44.  
  45. ospaceDir = File.GetPath( ollPath )
  46.  
  47. moduleDir = File.GetPath( ospaceDir )
  48.  
  49. moduleFile = File.StringToFile(moduleDir)
  50.  
  51.  
  52.  
  53. retVal.Path = moduleDir
  54.  
  55. retVal.File = moduleFile
  56.  
  57. retVal.ok = true
  58.  
  59.  
  60.  
  61. end
  62.  
  63.  
  64.  
  65. if (!retVal.ok)
  66.  
  67. if (IsUndefined(retVal.ErrMsg))
  68.  
  69. retVal.ErrMsg = Str.Format("Unable to determine path to the specified OSpace object. %s", osObj)
  70.  
  71. end
  72.  
  73. end
  74.  
  75.  
  76.  
  77. return retVal
  78.  
  79.  
  80.  
  81. end
Advertisement
Add Comment
Please, Sign In to add comment