Recent

Author Topic: primitive watch folder.. but, when downloaded  (Read 727 times)

ADMGNS

  • Jr. Member
  • **
  • Posts: 52
  • keep it simple and smart
primitive watch folder.. but, when downloaded
« on: September 10, 2025, 11:24:33 pm »
hello all

i,ve coded a primitive mini watch folder app, that works fine on linux, macos and windows..

a) copy and paste files into watch folder.. it works (ie, renames specified file types randomly)

b) drag and drop into watch folder.. it works

c) create a new file, or "save as..", or duplicate, or rename a file.. it works

but

d) when download (and save here each time) into that watch folder.. it DOESN't work

what is the difrrence in logical aspect so that causes working not..

thanks


Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: primitive watch folder.. but, when downloaded
« Reply #1 on: September 12, 2025, 10:48:44 am »
You use adddirseparator too much. The local dir is simply a dot or an empty path so it gets skipped in processing? If you add a dirseparator to an empty path you end up in the root of the drive. Make sure the directory where the program lives has at least the dot or the dot + dirseparator.
E.g.  ".", "./" or ".\"
This goes for windows mac and linux.

There's your logic.

Another minor issue is that you should expand relative paths to full paths.
That is not strictly necessary when the above is properly implemented.

You can also use the standard , i believe  cross platform, dirwatch unit that comes with freepascal , of course.....

« Last Edit: September 12, 2025, 11:35:28 am by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

ADMGNS

  • Jr. Member
  • **
  • Posts: 52
  • keep it simple and smart
Re: primitive watch folder.. but, when downloaded
« Reply #2 on: September 12, 2025, 03:12:25 pm »
hello @thaddy

thanks for reply and suggests.

i've added a "fuse" line to avoid empty folders to interpreting as / (root folder). but the result is same, unfortunately.

function customAddDirSep(const dir: string): string;
var
  s: string;
begin
  s := dir; if trim(s) = '' then s := defaultWkDir;   // fuse line !! defaultWkDir is "/home/user/Desktop/RENAMER/"
  Result := s;
  if Result[Length(Result)] <> PathDelim then
    Result := Result + PathDelim;
end;

i think, the problem is about from browsers' security issues and behaviors while downloading..

thanks again..

regs

 

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: primitive watch folder.. but, when downloaded
« Reply #3 on: September 12, 2025, 03:26:03 pm »
Try making your media download directory a subdirectory of Downloads.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

ADMGNS

  • Jr. Member
  • **
  • Posts: 52
  • keep it simple and smart
Re: primitive watch folder.. but, when downloaded
« Reply #4 on: September 13, 2025, 02:49:00 pm »
hello

at the end of day, i think, i,ve just found the problem's source..

but, i,m still not sure and i dont know the real reason..

so.. when using chromium based browsers, they save firstly a temporary filename with extension .crdownload, then, gives the original filename to the downloaded material.

but, mozilla/firefox and webkit based browsers are ok.. they have no such confusing behaviors..

thanks..

Thaddy

  • Hero Member
  • *****
  • Posts: 18363
  • Here stood a man who saw the Elbe and jumped it.
Re: primitive watch folder.. but, when downloaded
« Reply #5 on: September 13, 2025, 05:54:01 pm »
Actually that is NOT ok. You should not process partial downloads. These are likely locked.. and that is your problem, now I understand.
« Last Edit: September 13, 2025, 06:03:10 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018