Using files inside a ZIP

General discussions on potential enhancements to the APL+Win system.

Using files inside a ZIP

Postby Ajay Askoolum » March 31st, 2018, 4:07 pm

I can read files within a ZIP file using NOTEPAD or NOTEPAD++ without any issue.

Attempting a native tie on the same file from APL+Win reports
Code: Select all
XFHOST ERROR _sopen 1005 2 3 The system cannot find the path specified.


Can []ntie and []ftie be enhanced to enable read access to files inside ZIP files?
Ajay Askoolum
 
Posts: 686
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Using files inside a ZIP

Postby Davin Church » March 31st, 2018, 5:42 pm

I'm betting you'll have to unzip the file first. That's probably what Windows is doing for you before it hands it off to Notepad for viewing.
Davin Church
 
Posts: 437
Joined: February 24th, 2007, 1:46 am

Re: Using files inside a ZIP

Postby Ajay Askoolum » March 31st, 2018, 9:50 pm

Both NOTEPAD and NOTEPAD++ access the file on a read only basis.

If these applications are extracting the file in the background, it would be interesting to know at what location that happens since there is no (new) file created at the location of the ZIP file.

I suspect that APL+Win verifies the physical existence of the file i.e. in the filing system and does not go any further if it doesn't find it.
Code: Select all
      'E:\ZIP\wip.zip\wip2.sql' ⎕ntie ¯1
FILE NOT FOUND
      'E:\ZIP\wip.zip\wip2.sql' ⎕ntie ¯1
                                ^
      'E:\ZIP\wip.zip\wip2.sql' ⎕xntie ¯1
XFHOST ERROR _sopen 1005 2 3 The system cannot find the path specified.
      'E:\ZIP\wip.zip\wip2.sql' ⎕xntie ¯1
                                ^
It might be possible to enhance the logic that verifies the existence of a file to include searching inside ZIP files when specified in the path.

I can extract an individual file from a ZIP file programmatically from APL+Win - it adds a run time overhead.I am trying to see if this can be avoided.

It is interesting that file association works sometimes: typing

E:\ZIP\wip.zip\APLWS.w3 in File Explorer launches APL+Win which loads the workspace. (W3 associated with APLW.EXE)
E:\ZIP\wip.zip\wip2.sql in File Explorer launches SSMS which opens the file. (.SQL associated with SQL Server Managemenbt Studio).
E:\ZIP\wip.zip\ajay.xlsx in File Explorer launches Excel but Excel reports that it cannot find the file (.XLSX associated with Excel)
Ajay Askoolum
 
Posts: 686
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Using files inside a ZIP

Postby Ajay Askoolum » March 31st, 2018, 10:23 pm

UPDATE: it appears that the file is extracted dynamically.
Code: Select all
C:\USERS\AJAYASKOOLUM\APPDATA\LOCAL\TEMP\TEMP2_WIP.ZIP\APLWS SAVED 01 April 2018 02:54:06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
      43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
      80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
      )wsid
IS C:\USERS\AJAYASKOOLUM\APPDATA\LOCAL\TEMP\TEMP2_WIP.ZIP\APLWS
Note the WSID reported: the workspace was loaded by typing E:\ZIP\wip.zip\APLWS.w3 in File Explorer.

So, the dynamic extraction can also apply to native/component files?
Ajay Askoolum
 
Posts: 686
Joined: February 22nd, 2007, 2:16 am
Location: United Kingdom

Re: Using files inside a ZIP

Postby Davin Church » March 31st, 2018, 11:35 pm

Again, I believe all that work is done directly by the OS interface without involving the applications at all. So anything that goes through Windows/File Explorer can have IT look inside the ZIP for it, but applications still have no native idea how ZIPs work. Look at the different ways that Windows has treated ZIP (and CAB and similar format) files over the versions and you'll see that it got progressively more and more integrated with Windows/File Explorer, even when nothing else has changed. This explanation also fits with all of your descriptions of its behavior.

I don't think you're going to do better than unzipping it yourself first. If you absolutely can't write a temporary disk file, I think it's possible to navigate the internal directory structure of the zip file by binary-reading it with APL and then using []DR to unpack the contents in memory.
Davin Church
 
Posts: 437
Joined: February 24th, 2007, 1:46 am

Re: Using files inside a ZIP

Postby Davin Church » March 31st, 2018, 11:38 pm

As far as adding that feature to APL when (apparently) no other application does it, I'd have to ask whether there's enough demand for it from everyone to be important. Personally, I don't see that most people would ever have a need for it, and an easy workaround is available for the few needs that do exist.
Davin Church
 
Posts: 437
Joined: February 24th, 2007, 1:46 am


Return to APL+Win Wish-List

Who is online

Users browsing this forum: No registered users and 1 guest