Author Topic: Tech question about file linking, anybody knows?  (Read 3085 times)

0 Members and 1 Guest are viewing this topic.

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Tech question about file linking, anybody knows?
« on: July 21, 2021, 03:43:52 pm »
On Windows:

When I save a website in Firefox, eg. the QB64 Wiki Main page (Menu: File -> Save As / or respectively Ctrl-S), then Firefox does create a .html file with the actual site contents and a folder which contains all files (such as linked images, css etc.) required to properly show that site offline.

This .html file and the respective folder are linked in such a way, so that every action done to either in the Explorer does automatically do the same with the other. Ie. if I select the .html only and delete it, then it will automatically delete the folder too. If I move the folder to a new location, then the .html file will automatically follow that move. Same with copy.

Now I'm curious how this connection is done, as I could really use this feature for one of my programs. I looked at the properties of both, the .html and the respective folder, but there is nothing obvious telling how it's done.

The MKLINK command line instruction does not do this type of interconnection, and searching the internet for things like "file/folder interconnection", "file bindings", "file/folder link" and several similar phrases do not show up any useful stuff, but points always back to the MKLINK type linking.

So somehow this .html file and the folder must be magically connected, so that every action done on the one, does magically trigger the same action for the other. Is anybody here who could point me into the right direction?, maybe our WinAPI Guru @SpriggsySpriggs?

Any way to do such connections would be acceptable, SHELLing command line, powershell, vbs or even making a C-header directly using the WinAPI.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Tech question about file linking, anybody knows?
« Reply #1 on: July 21, 2021, 03:48:44 pm »
@RhoSigma Well, you're in luck. I happened to get the right keyword while Googling your query. https://docs.microsoft.com/en-us/windows/win32/shell/manage?redirectedfrom=MSDN#connected. Look for the section labeled "Connected Files".

Looks like it is as simple as having a document with an htm or html extension and naming a folder the same as the document, minus the extension but plus _files. So, doc.htm and doc_files
« Last Edit: July 21, 2021, 03:52:28 pm by SpriggsySpriggs »
Shuwatch!

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Tech question about file linking, anybody knows?
« Reply #2 on: July 21, 2021, 04:06:37 pm »
Thanks @SpriggsySpriggs for that quick response, I'll check this out :)
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Tech question about file linking, anybody knows?
« Reply #3 on: July 21, 2021, 04:26:10 pm »
@RhoSigma Also, consult these two links. While looking at Connected Files, I was brought to this function: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationa. The struct it uses, https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileopstructa, has flags for moving a file without moving the connected elements. I feel this might set you on the path you're wanting to go.
Shuwatch!

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Tech question about file linking, anybody knows?
« Reply #4 on: July 21, 2021, 04:56:07 pm »
Thanks @SpriggsySpriggs, but no more effords required.

It turns out this is a special feature just made for the sake of saved offline websites. I was hoping I can connect several depending single files that way, so that they all get moved/copied/deleted, if either one is selected.

I'll probably go the other way, which eg. Word uses in its .docx format. The .???x Office formats are in fact nothing else than zip compressed folders, just rename a .docx into .zip and then you can look inside and you'll see several files and/or folders which all belong to that single document.

Once again thanks for your effords.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Tech question about file linking, anybody knows?
« Reply #5 on: July 21, 2021, 05:57:03 pm »
@RhoSigma I've noticed that about docx as well. Same thing with cbr and cbz. Just zip files.
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Tech question about file linking, anybody knows?
« Reply #6 on: July 21, 2021, 07:18:01 pm »
@RhoSigma I've noticed that about docx as well. Same thing with cbr and cbz. Just zip files.

And epub as well, which might suit your needs the most, if you’re dealing with html (xhtml specifically) stuff.  https://www.w3.org/publishing/epub3/epub-spec.html
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!