Hi All, Does anyone have an example of using CfsFileDescriptor>touch:time: to change the date/times on a file? It seems simple enough but I can't get it to work. I think I'm suppling the date/time array correctly but maybe not. When I try CfsFileDescriptor>touch: (without the time, which uses the current time) it works. So, it would seem my supplied time value has something to do with it. Thanks in advance for any help or hints. Lou You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
I don't think I had seen such a method before. It looks useful. I am using MSKOperatingServices code to do this kind of thing - methods being
-- SetFileTimestamp:fromFileTimeCAMArray: or SetFileTimestamp:fromCfsStat: You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
It looks like adjustment to the size of the time_t datatype have happened over time in compilers to account for the 2038 bug.
-- There is more to the store for an ultimate fix, but for now, changing CfsFileDescriptor>>tm: aDateAndTimeArray to look like this should get the behavior needed. I will open a case on this item | time | ^(OSUInt32 new: 4) at: 0 put: (time := (CfsOSTmPtr fromDateAndTime: aDateAndTimeArray) mktime); at: 2 put: time; yourself. -- Seth Berman On Tuesday, June 10, 2014 6:15:16 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
Opened case 54806 to correct this item.
-- On Tuesday, June 10, 2014 6:15:16 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Seth Berman
Hi Seth, Thanks for the fix. The change gets us past the unknown OS error but there is still a little problem. CfsOSTmPtr>fromDateAndTime: shouldn't subtract 1 from the #dayIndex when it sets #tmYday:. It causes the date to be one day early. Lou On Wednesday, June 11, 2014 11:59:11 AM UTC-4, Seth Berman wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Seth Berman
Hi Seth, I forgot to ask about #date in #MZUnzFileInfo, what is it? It is mapped to #MZTmZip. There seems to be two dates and times here but the values I get from a zip file are very odd. There must be something wrong with the mapping. One of the dates seems to have a month field with a value of 2014 which is a year and a year of 0. Some of the other parts look even worse. Lou On Wednesday, June 11, 2014 11:59:11 AM UTC-4, Seth Berman wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
Hi Louis,
-- Did you mean #tmWday? If so, I see that dayIndex is the day of the week...so Sunday is 1. I see the tm struct field tm_wday is "days since Sunday" which begins at 0. I'm assumming that's why I see the "tmWday: (aDateAndTimeArray at: 1) dayIndex - 1". Is this how you are interpreting it? -- Seth On Thursday, June 12, 2014 5:11:06 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Louis LaBrunda
Hi Louis,
-- It's good that you brought this up because it looks like the definition for MZTmZip is wrong. The primary issue is that all the fields in this structure are supposed to be 4 byte uint32 and not 2 byte uint16s. This also means it's fixed size is 24 not 12. The way it's also being accessed in MZZipFileInfo>>date is incorrect...that should just simply be "self structAt: 56 type: MZTmZip" (that's why you see a 2 slot array). Once I fixed these issues then all was well. I will need to put a case in for this...will be fixed in our next release. I will add you as a correspondence to the case if you would like....just let me know. -- Seth On Thursday, June 12, 2014 5:19:18 PM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Case 54832 created for MZTmZip fixes
On Thursday, June 12, 2014 7:02:02 PM UTC-4, Seth Berman wrote: -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Seth Berman
Hi Seth, Thanks for looking into all this. Big picture - I'm playing with MZZipArchive and friends to zip/unzip zip files. After unzipping and writing a file to disk I want to change the date/time info to match the file in the zip file. I was misinterpreting
the date related fields but only because I didn't look at them very carefully. I noticed the resultant dates were off by one day (early) and just removed the -1. Without the -1 all my tests of dates look good. As for MZTmZip and MZZipFileInfo>>date can you please post your change here, I would like to play with it a bit. Also, do you know what date/time MZZipFileInfo>>date is? Is it better to use for my purposes than dosDate? While you are looking at all this, you might want to think about adding MZUnzFileInfo>dateAndTimeFromDosDate to answer a date/time array (and maybe one for date/time from the #date field). I have added this as an extension and since I think others could use the method, you are welcome to the code. Lou
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Hi Lou,
-- Concerning which date should be used, it looks like it doesn't matter. The comment in the minizip source simply says the MZTmZip is the same 4-byte dosDate "in an understandable format". Of course, this assumes we read this struct correctly:). Attached is a fileout of 3 classes to correct the issue. You may want to manually execute MZTmZip>>initializeAfterLoad to be sure the fixed size is updated. The primary change is the definition of MZTmZip. MZUnzFileInfo and MZZipFileInfo #date methods have been updated to retrieve the struct correctly I would go ahead and open a support request for the extension methods and let us know what you think...we would be happy to review for inclusion. -- Seth On Friday, June 13, 2014 10:34:31 AM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. MZZipUnzipApp852_fixes1.txt (3K) Download Attachment |
In reply to this post by Louis LaBrunda
I forgot that little-endian format is required for zip.
-- You won't currently see an functional impact, but just to be safe, I am attaching an update. -- Seth On Friday, June 13, 2014 10:34:31 AM UTC-4, Louis LaBrunda wrote:
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. MZZipUnzipApp852_fixes2.txt (3K) Download Attachment |
Hi Seth, Everything looks good so far. Below are the methods I've added, in case anyone is interested. I will also submit them to tech support. Lou MZTmZip>dateAndTime MZUnzFileInfo>dateAndTimeFromDate MZUnzFileInfo>dateAndTimeFromDosDate
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/va-smalltalk. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |