Boa tarde,
Consegui resovler adicionando uma verificação de proteção na parametrização do PathSalvar na função TArquivosConf.GetPath, caso haja melhoramentos no código, desculpe em nao ajudar 100%
Estou adicionando a unit em anexo
function TArquivosConf.GetPath(const APath: string; const ALiteral: string; const CNPJ: string = ''; const IE: string = ''; Data: TDateTime = 0; const ModeloDescr: string = ''): string;
procedure AddPathOrder(AAdicionar: Boolean; AItemOrdenacaoPath: TTagOrdenacaoPath);
begin
if AAdicionar then
FOrdenacaoPath.Add.Item := AItemOrdenacaoPath;
end;
var
wDia, wMes, wAno: word;
Dir, Modelo, sAno, sMes, sDia, CNPJ_temp, IE_temp: string;
LenLiteral, i: integer;
begin
if EstaVazio(APath) then
Dir := PathSalvar
else
Dir := APath;
//se nao foi informada nenhuma ordenação, cria ordenação na ordem anterior (compatibilidade)
if (FOrdenacaoPath.Count = 0) then
begin
AddPathOrder(SepararPorCNPJ, opCNPJ);
AddPathOrder(SepararPorIE, opIE);
AddPathOrder(SepararPorModelo, opModelo);
AddPathOrder((SepararPorAno or SepararPorMes or SepararPorDia), opData);
AddPathOrder(AdicionarLiteral, opLiteral);
end;
for i := 0 to FOrdenacaoPath.Count - 1 do
begin
case FOrdenacaoPath[i].Item of
opCNPJ:
begin
CNPJ_temp := OnlyNumber(CNPJ);
if EstaVazio(CNPJ_temp) then
if Assigned(fpConfiguracoes.Owner) then
CNPJ_temp := OnlyNumber(TACBrDFe(fpConfiguracoes.Owner).SSL.CertCNPJ);
if NaoEstaVazio(CNPJ_temp) and not AnsiContainsText(Dir, CNPJ_temp) then
Dir := PathWithDelim(Dir) + CNPJ_temp;
end;
opIE:
begin
IE_temp := OnlyNumber(IE);
if NaoEstaVazio(IE_temp) and not AnsiContainsText(Dir, IE_temp) then
Dir := PathWithDelim(Dir) + IE_temp;
end;
opModelo:
begin
if (ModeloDescr = '') and Assigned(fpConfiguracoes.Owner) then
Modelo := TACBrDFe(fpConfiguracoes.Owner).GetNomeModeloDFe
else
Modelo := ModeloDescr;
if not AnsiContainsText(Dir, Modelo) then
Dir := PathWithDelim(Dir) + Modelo;
end;
opData:
begin
if Data = 0 then
Data := Now;
DecodeDate(Data, wAno, wMes, wDia);
sDia := IntToStrZero(wDia, 2);
sMes := IntToStrZero(wMes, 2);
sAno := IntToStrZero(wAno, 4);
if SepararPorAno and not AnsiContainsText(Dir, sAno) then
Dir := PathWithDelim(Dir) + sAno;
if SepararPorMes and not AnsiContainsText(Dir, sMes) then
begin
if SepararPorAno and not AnsiContainsText(Dir, sMes) then
Dir := PathWithDelim(Dir) + sMes
else if not AnsiContainsText(Dir, sAno + sMes) then
Dir := PathWithDelim(Dir) + sAno + sMes;
if SepararPorDia and not AnsiContainsText(Dir, sDia) then
Dir := PathWithDelim(Dir) + sDia;
end;
end;
opLiteral:
begin
LenLiteral := Length(ALiteral);
if (LenLiteral > 0) then
begin
if (RightStr(Dir, LenLiteral) <> ALiteral) and not AnsiContainsText(Dir, ALiteral) then
Dir := PathWithDelim(Dir) + ALiteral;
end;
end;
end;
end;
if not DirectoryExists(Dir) then
ForceDirectories(Dir);
Result := Dir;
end;
ACBrDFeConfiguracoes.pas