home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / config_vb.tcl < prev    next >
Text File  |  1997-03-18  |  2KB  |  96 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc. 1996
  4. #
  5. #      File:           @(#)config_vb.tcl    /main/hindenburg/8
  6. #      Author:         
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)config_vb.tcl    /main/hindenburg/8   18 Mar 1997 Copyright 1996 Cayenne Software Inc.
  10.  
  11. source [m4_path_name tcl cginit.tcl]
  12.  
  13. require wmt_util.tcl
  14. require machdep.tcl
  15.  
  16. proc m4copyfile {dir custName {fsName ""}} {
  17.     if {$fsName == ""} {
  18.         set fsName $custName
  19.     }
  20.  
  21.     if [file exists $fsName] {
  22.         set sourcefile $fsName
  23.     } else {
  24.         set sourcefile [m4_path_name $dir $fsName]
  25.     }
  26.  
  27.     set customFileV [findCustomizationFile $custName 1]
  28.  
  29.     $customFileV lockForWrite "Configure VB Environment"
  30.  
  31.     $customFileV upLoad $sourcefile
  32.  
  33.     $customFileV unlock
  34. }
  35.  
  36. proc m4basedir {} {
  37.     set clientContext [ClientContext::global]
  38.  
  39.     set configV [$clientContext currentConfig]
  40.  
  41.     if {[$configV isNil]} {
  42.         return [m4_var get M4_home]
  43.     }
  44.  
  45.     return [$configV path]
  46. }
  47.  
  48. proc findCustomizationFile {fullName {create 0}} {
  49.     set name [lindex [split $fullName .] 0]
  50.     set type [lindex [split $fullName .] 1]
  51.     set clientContext [ClientContext::global]
  52.  
  53.     set configV [$clientContext currentConfig]
  54.  
  55.     set customFileV [$configV findCustomFileVersion $name $type]
  56.  
  57.     if {$create && [$customFileV isNil]} {
  58.         puts "Creating customization file '$fullName' at configuration level"
  59.         set customFileV [$configV createCustomFileVersion $name $type]
  60.     }
  61.  
  62.     return $customFileV
  63. }
  64.  
  65. proc m4copydir {dir} {
  66.         set save_dir [pwd]
  67.         set subdir [location config $dir]
  68.         if [catch {set cddir [m4_path_name $subdir ClassSet.cls]}] {
  69.                 return
  70.         }
  71.  
  72.         set PhaseV [[ClientContext::global] currentPhase]
  73.  
  74.         cd [path_name directory $cddir]
  75.  
  76.         set base [m4basedir]
  77.         set files [glob -nocomplain *]
  78.         set dest [location [$PhaseV path] src]
  79.         if {! [file exist $dest]} {
  80.                 mkdir -path [list $dest]
  81.         }
  82.         foreach file $files {
  83.                 puts "copying $file to $dest"
  84.                 copy_text_file $file [location $dest $file]
  85.         }
  86.         cd $save_dir
  87. }    
  88.  
  89. set cc [ClientContext::global]
  90. if {[[[$cc currentPhase] phase] type] != "ObjectDesign"} {
  91.    m4copydir [location src VB]
  92. } else {
  93.    require VisualBasicGUI.tcl
  94. }
  95.  
  96.