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, Vasyl-Tracker Dev Team, Chris - Tracker Supp, 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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

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
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 »

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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

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
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 »

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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

Hi Alex,

ok, thanks.

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

-žarko
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 »

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: 1370
Joined: Thu Sep 05, 2019 12:35 pm

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

Post by zarkogajic »

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: 2352
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 »

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: 1370
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 »

Hi Vasyl,

Thanks!

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

-žarko
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
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 »

:)
Post Reply