Página 1 de 1

Como funciona o SET PATH no xHarbour

Enviado: 14 Mar 2008 16:52
por Zeca Roque
Eu uso um arquivo DBF para armazem todos os paths que preciso.
Normalmente retiro do DBF, como abaixo, e ele funciona normalmente.
Acontece que no xharbour não está funcionando. Para acessar um arquivo tenho de chamar inclusive pelo path.
O que acontece com o SET PATH no xharbour ?

Código: Selecionar todos

   cPath_TRC:=ALLTRIM(TRANSPORTE)+"\"
    arquivo:=cPath_TRC+"data.dbf"
    IF EMPTY(ESTACAO)
     TRAVA_REG()
     REPLACE ESTACAO WITH GETENV("ESTACAO")
     UNLOCK
    ENDIF
    IF !EMPTY(TRANSPORTE)
     cPath_Geral:=ALLTRIM(TRANSPORTE)+";"+ALLTRIM(cPath_Win)
    ENDIF
    IF !EMPTY(COLETA)
     cPath_Geral:=ALLTRIM(TRANSPORTE)+";"+ALLTRIM(cPath_win)+";"+ALLTRIM(COLETA)
    ENDIF
    IF !EMPTY(FATURA)
     cPath_Geral:=ALLTRIM(TRANSPORTE)+";"+ALLTRIM(cPath_win)+";"+ALLTRIM(COLETA)+";"+ALLTRIM(FATURA)
    ENDIF
    IF !EMPTY(MINUTA)
     cPath_Geral:=ALLTRIM(TRANSPORTE)+";"+ALLTRIM(cPath_Win)+";"+ALLTRIM(COLETA)+";"+ALLTRIM(FATURA)+";"+ALLTRIM(MINUTA)
    ENDIF
    IF programa="TRANSPORTES"
     cPath_Geral:=ALLTRIM(TRANSPORTE)+";"+cPath_win+";"+ALLTRIM(COLETA)+";"+ALLTRIM(FATURA)+";"+ALLTRIM(MINUTA)
    ELSE
     cPath_Geral:=ALLTRIM(MINUTA)+";"+cPath_win+";"+ALLTRIM(TRANSPORTE)+";"+ALLTRIM(FATURA)+";"+ALLTRIM(COLETA)
    ENDIF
    cPath_Geral=UPPER('"'+cPath_Geral+'"')
    set path to &cPath_Geral
   
:'(

Enviado: 15 Mar 2008 10:14
por Luciano Bonfim
SET PATH
Set the search path for opening files.
Syntax
SET PATH TO [<cDirectoryList>]

Arguments
TO <cDirectoryList>
The <cDirectoryList> parameter specifies one or more directories to search for files when they are not found. A single directory in the list may contain a drive letter, followd by a colon, and subdirectories prefixed with a backslash. individual directories in <cDirectoryList> are separated with semicolons. <cDirectoryList> can be specified as a string literal or as a character expression enclosed in parentheses. If <cDirectoryList> is omitted, the current drive and directory of the operating system is used as default.
Description
The SET PATH command defines an additional search path for opening files when they cannot be found. This affects databases and associated files.
Files are searched in the following order:
1) The current directory of the operating system.

2) The SET DEFAULT directory.

3) The directories specified with SET PATH.

Note that low-level file functions like FOpen() do not use SET PATH or SET DEFAULT for searching files.
Info
See also: CurDir(), Set(), SET DEFAULT
Category: SET commands
Source: rtl\set.c
LIB: xhb.lib
DLL: xhbdll.dll

Example
// The example demonstrates how to define a search path

// single directory
SET PATH TO D:\xhb\apps\

// multiple directories
SET PATH TO "D:\xhb\apps\;D:\xhb\data\;"