How can I marshall File::Stat, and do file tests?

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default How can I marshall File::Stat, and do file tests?

    Basically, I'm building a Hash of paths to their File::Stat, and
    Marshal.dumping it. Later I'll load it, and
    compare the current filesystem state to the state I saved.

    Simple, right?

    But, I can't marshall File::Stat, it's not allowed/supported.

    Irritating, but no problem, I'll build a Struct with all the values from
    the File::Stat that I want to save, and put that in the Hash instead,
    right?

    Well, that doesn't work so well, either. Now when I load that, I have
    no way to construct a File::Stat out of my own data (it lacks a "new"),
    and I lose all of File::Stats handy methods to see what kind of file it
    is, and its permissions, etc.

    Any suggestions? Can I define my own _load() and _dump() for File::Stat?
    Is that the right way? Am I not allowed to marshall File::Stat because
    its contents are system specific?

    Thanks for any pointers on how to deal with this,
    Sam


    Sam Roberts Guest

  2. Similar Questions and Discussions

    1. Create tests using a data file for questions
      Is it possible to pull questions from a data file into flash without having to create new frames for every question. This would be a multiple...
    2. problem in binding xml file data to datagrid xml file isgenerated through JSP file
      problem it that i am creating xml file using JSP file and i want to bind DataGrid with xml file data that is created using JSP but it will not Bind...
    3. File Viewer / Bloated file sizes / What is the best file format?
      I would like to find a viewer capable of looking at the main Adobe formats as well as the standard formats such as JPG and WMF ... but yet the only...
    4. [BUG] File#rewind, File#syswrite, File#pos on Cygwin build
      On the cygwin build of ruby v1.8.0, I have encountered a strange bug when using rewind, syswrite and pos. If you open a file in read/write mode,...
    5. File.stat.blksize returns nil and not 0 on win2k
      Hello, on the 1.8.0 ruby version of the pragprog installer, File.stat(file).blksize returns nil and not 0 on a windows 2k machine. According to...
  3. #2

    Default Re: How can I marshall File::Stat, and do file tests?

    Seems to be a long-standing oddity, discussed in ruby-talk #74175 and
    #74162, but I still can't find a resolution to it.

    Still searching...

    Sam

    Quoteing [email]sroberts@uniserve.com[/email], on Sun, Nov 02, 2003 at 12:08:34PM +0900:
    > Basically, I'm building a Hash of paths to their File::Stat, and
    > Marshal.dumping it. Later I'll load it, and
    > compare the current filesystem state to the state I saved.
    >
    > Simple, right?
    >
    > But, I can't marshall File::Stat, it's not allowed/supported.
    >
    > Irritating, but no problem, I'll build a Struct with all the values from
    > the File::Stat that I want to save, and put that in the Hash instead,
    > right?
    >
    > Well, that doesn't work so well, either. Now when I load that, I have
    > no way to construct a File::Stat out of my own data (it lacks a "new"),
    > and I lose all of File::Stats handy methods to see what kind of file it
    > is, and its permissions, etc.
    >
    > Any suggestions? Can I define my own _load() and _dump() for File::Stat?
    > Is that the right way? Am I not allowed to marshall File::Stat because
    > its contents are system specific?
    >
    > Thanks for any pointers on how to deal with this,
    > Sam
    >
    >
    Sam Roberts Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139