El 04/08/16 a las 12:03, Mattias Gaertner escribió:
On Thu, 4 Aug 2016 07:59:14 -0300
Leonardo M. Ramé <[email protected]> wrote:

[...]
mounted NFS one.

I must add the user has write permissions on the mounted path, in fact
before posting this I've tried creating a text file without using
TFileStream and it worked without an issue, so I assume the problem is
with TFileStream:

      // This works:

      AssignFile(f, '/mnt/data_vultr/documents/test.txt');
      {$I-}
      Rewrite(f);
      {$I+}
      if IOResult =0 then
      begin
        System.WriteLn(f, 'aaaa');
        System.WriteLn(f, 'bbb');
      end;
      System.Close(f);


      // this doesn't work

      lFileStream := TFileStream.Create(lFile, fmCreate);
Try
lFileStream := TFileStream.Create(lFile, fmCreate or fmShareDenyNone);

NFS often does not support locking.

      AMemStream.Position := 0;
      lFileStream.CopyFrom(AMemStream,AMemStream.Size);

I'll try that, meanwhile it worked using this:

      var lBinaryFile: file;
      ...
      lFile := '/path/to/mounted/nfs/file.bin';
      AssignFile(lBinaryFile, lFile);
      {$I-}
      Rewrite(lBinaryFile);
      {$I+}
      if IOResult = 0 then
      begin
        BlockWrite(lBinaryFile, AMemStream.Memory, AMemStream.Size);
        System.Close(lBinaryFile);
      end;

Regards,
--
Leonardo M. Ramé http://leonardorame.blogspot.com
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to