rejetto forum

Possible bug with add context menu when select files with same name

Mars · 4 · 3920

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
error resolved by modificate the code

Quote
function Tmainfrm.addFilesFromString(files:string; under:Ttreenode=NIL):Tfile;
......
var
  f: Tfile;
  kind, s, fn, fntemp: string;  //mod by mars
  doubles: TStringDynArray;
  res: integer;
.........
// warn upon double filenames
doubles:=NIL;
s:=files;
while s > '' do
   begin
  fn:=chopLine(s);
  if isExtension(fn, '.lnk')
  or directoryExists(fn) and fileExists(fn+'\target.lnk')
  then
    begin
    fntemp:=resolveLnk(fn);
    files:=xtpl(files,[fn,fntemp]);
    fn:=fntemp;
    end;

  if (length(fn) = 3) and (fn[2] = ':') then fn:=fn[1]+fn[2] // unit root folder
   else fn:=ExtractFileName(fn);
  if existsNodeWithName(fn, under) then
    if addString(fn, doubles) > MAX_DUPE then
      break;
  end;

now there is no sharing filename with ''on 'computer' " and the warning make his come back

BUG if you answer yes on the warning, the name is incremented
 



Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Create some shortcuts of a folder (or a file), add them to the VFS real or virtual, the names of shortcuts are kept: 'shorcut of name' , 'shorcut[2] of name'  ...

if you create a lot of N shorcuts linkeds to one folder then the same folder is added to the VFS with N differents names at the same place.

With the modification, the resolved name of the folder or file is added to the vfs and incremented if necessary, it is easier to dectect clones

There is another modification bound to the one who never allows to add doubloons


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i'm not sure how HFS should behave in such case.
i mean, a user asks HFS to add 2 items, that are shortcuts to the same folder, but with different name.
maybe we should just add them as we are doing now.
although it doesn't seem very important to me, i guess the best way to do is what the user expects HFS to do.
if you really think the current way is wrong, i will make a poll.