IPXC_Action_URI - is URI a file:// or something else URL like  SOLVED

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1097
Joined: Thu Sep 05, 2019 12:35 pm

IPXC_Action_URI - is URI a file:// or something else URL like

Post by zarkogajic » Wed Mar 10, 2021 4:19 pm

Hi Support,

Some "help" needed - to try to mimic how you internally decide if URL value from IPXC_Action_URI is a file or is a "web style value" ?

Example:

if URI returns "..\file.pdf" - you internally figure out this is a file protocol
if URI returns "google.com" - you internally figure out this is a file protocol
if URI returns "www.google.com" - you internally figure out this is a http protocol

Are there any ready made functions to check if a given string (IPXC_Action_URI.Get_URI) is a file:/// or should it go online...

-žarko

User avatar
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by Sasha - Tracker Dev Team » Fri Mar 12, 2021 12:16 pm

Hello zarkogajic,

Sadly this is not included in the SDK methods.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 1097
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by zarkogajic » Fri Mar 12, 2021 12:43 pm

Hi Alex,

LOL :)

I (kind of) know that no methods are exposed via SDK for this.

I'm, obviously, asking for some insight into your inner logic - what's your algorithm to decide if a "path" is something that smells like a file:/// schema or not.

My take on this:

- if it contains a colon (":") - it could *not* be a file:/// as ":" cannot be in a file system path folder or file name
-> if it starts with "http:", "mailto:", and alike (there are quite a few) - it is also not a file

What puzzles me is how you treat "www.google.com" - it seems you append "http://" to it - even though such a named file could actually exists on the file system - and therefore the URL part of the IPXC_Action_URI could really be pointing to a file - and not http://www.google.com.


-žarko

User avatar
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by Sasha - Tracker Dev Team » Fri Mar 12, 2021 2:45 pm

Hello zarkogajic,

Well, from what I saw, there is too much code to simply paste it here.
What we do is first check whether the file is local (using some WinApi methods along with string analyze). Then again we check whether it's an URI and act from here.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 1097
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by zarkogajic » Fri Mar 12, 2021 2:48 pm

Hi Alex,

ok, thanks.

But you do append "http://" when it starts with "www." ?

-žarko

User avatar
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by Sasha - Tracker Dev Team » Mon Mar 22, 2021 10:40 am

Hello zarkogajic,

Append where? We are using a bunch of winapi methods for all of this stuff and then if that's an URI - we call that as an URI.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

zarkogajic
User
Posts: 1097
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by zarkogajic » Mon Mar 22, 2021 12:09 pm

Hi Alex,

Thanks for the follow up.

It would be fantastic if you could share what APIs you are using for this ...

-žarko

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2102
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: IPXC_Action_URI - is URI a file:// or something else URL like

Post by Vasyl-Tracker Dev Team » Tue Nov 09, 2021 9:09 pm

Hi Zarko.

GetFileAttributes
FindFirstFile
SHGetFileInfo
...
PathIsURL
PathCreateFromUrl
PathCanonicalize
PathCombine
UrlIs
UrlCombine
...

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

zarkogajic
User
Posts: 1097
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXC_Action_URI - is URI a file:// or something else URL like  SOLVED

Post by zarkogajic » Wed Nov 10, 2021 11:47 am

Hi Vasyl,

Thanks!

That's along the lines of what I'm using ...

-žarko

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 14680
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

IPXC_Action_URI - is URI a file:// or something else URL like

Post by Tracker Supp-Stefan » Wed Nov 10, 2021 11:49 am

:)

Post Reply