[Gambas-devel] Stat command

Fabien Gambasfr at ...4...
Wed Feb 19 22:05:44 CET 2003


hello all , hello Nigel

Scuse me for my forget...

Change the function Validate in FSelector by :


'**********************

PUBLIC FUNCTION Validate() AS Boolean

  DIM sFile AS String
  
 
  
  'Validation
  IF txtFile.Text = "" THEN RETURN
  
  sFile = txtFile.Text
  
  SELECT CASE iDialogType
    CASE SELECT_PROJECT
      IF File.Name(Root) = sFile THEN sFile = ""
      IF Exist(Root &/ sFile &/ ".project") THEN 
      Path = Root &/ sFile
      GOTO GOOD '$BM
      ENDIF
      Message.Error("Cannot found this project")    
    
    CASE SELECT_DIRECTORY
      IF Exist(Root &/ sFile) THEN
        IF File.Name(Root) = sFile THEN sFile = ""
        Stat(Root &/ sFile)
        IF File.Type = gb.Directory THEN 
          Path = Root &/ sFile  
          GOTO GOOD '$BM
        ENDIF
      ENDIF
      Message.Error("Cannot found this directory")    
    
    CASE SELECT_FILE, SELECT_IMAGE
      
      IF bAllowNewFile THEN
        Path = Root &/ sFile
        GOTO GOOD
      ENDIF
      
      IF Exist(Root &/ sFile) THEN 
        Path = Root &/ sFile  
        GOTO GOOD
      ENDIF
        Message.Error("Cannot found this file")
      
      '$BM
  END SELECT
  RETURN
  
GOOD: '$BM

  IF Key THEN 
    IF iDialogType = SELECT_FILE OR iDialogType = SELECT_IMAGE THEN
      Project.Config.Write(Key, File.Dir(Path))
    ELSE
      Project.Config.Write(Key, Path)
    ENDIF
  ENDIF
  
  RETURN TRUE

END

'***************************


Fabien


PS
to benoit ...change it please!!





More information about the Devel mailing list