Como funciona o SET PATH no xHarbour

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Zeca Roque
Usuário Nível 2
Usuário Nível 2
Mensagens: 59
Registrado em: 11 Jul 2006 15:40
Localização: SÃO PAULO-CAPITAL

Como funciona o SET PATH no xHarbour

Mensagem 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
   
:'(
Saudacoes

José Carlos
Fw/Fwh - Clipper 52e - Blinker 7.0 - WS 4.50 - SIX - xHarbour110
Avatar do usuário
Luciano Bonfim
Usuário Nível 3
Usuário Nível 3
Mensagens: 414
Registrado em: 23 Ago 2007 09:34
Localização: Rio de Janeiro / São Paulo
Contato:

Mensagem 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\;"
Muito Obrigado,

Luciano Bonfim de Azevedo
www.bonfim.com.br
luciano@bonfim.com.br
www.linkedin.com/in/lucianobonfim
Skype : lucianobonfim
Responder