Recent

Author Topic: if FileExists fail as because AssianPath with filename inside NTFS.english.drive  (Read 1321 times)

d2010

  • Sr. Member
  • ****
  • Posts: 264
Hello..
My chinese-exe-program, extract to Unicode'path  ...
C:Q1=How fileExists, inside "Lazarus"as widestring? (is main question).
 :(
Fist. I try small read wideparamstr(1)
Second. The source of problem, is my win8English contain chinese'path,
             The fileName is englishname as "pp_ddvslide.vlax"
My project1.lpr fileexists('D:....\pp_ddvslide.vlax') result as false.
Please you can use gfnFiles *. from PBuffer.zip as optionally, or
 other function/s from Lazarus4.00
 ..
Code: Pascal  [Select][+][-]
  1. //Path...cosldlsp\Y+YYY¡+tY+-ª+ú\CNCNET-ª+ú\
  2. Library  widefpat;
  3. Uses windows;
  4. Function wide_after0next(const aWid:widestring;elsewdef:widechar):widestring;
  5. Var cnt,spc,dxf,dwg:integer;
  6. Begin
  7.  result:=elsewdef;
  8.  cnt:=00;
  9.  spc:=RTCAN;
  10.  dxf:=RTCAN;
  11.  for dwg:=01 to length(s098) do
  12.     Case (s098[dwg]) of
  13. widechar('"'): inc(dxf);
  14. Widechar(' '): Begin spc:=dwg;
  15.                      if (dxf=2) then break else
  16.                         if (dxf<00) then break;
  17.                end;
  18.   End;
  19.  if (spc>00) then result:=copy(aWid,spc+1,length(aWid)-spc);
  20. End;
  21.  
  22. Var s098:widestring='';
  23.      wideargw:widestring='';
  24. Begin
  25.   wideargw:=widestring(GetCommandLine,widechar('0'));
  26.   s098:=wide_after0next(wideargw,'0');
  27.   if (s098='0') then writeln('Argument 1  of project1.lpr is wrong') else
  28.     Begin writeln('Input file1=',s098);
  29.     End;
  30.         readln;
  31. End.
  32.  
Please.. you found other sources, attached here as .zip, otherwide You use LazUtils.
You can , add  the sources.
"function gfnsFilePathGet(sFile: WideString): WideString;"
"function gfnbFolderExists(sFolder: WideString): Boolean;"
"function gfnbFileExists(sFile: WideString): Boolean;"
Best regards...

« Last Edit: July 04, 2025, 03:24:08 pm by d2010 »

gues1

  • Guest
I had found that prefix '\\?\' to file name sometimes help (not only with "max length path" limits).

Example:

Code: Pascal  [Select][+][-]
  1.   filename := '\\?\D:....\pp_ddvslide.vlax';
  2.  

 

TinyPortal © 2005-2018