12

I have a Windows Firemonkey app that uses TClientDatasets to load XML data files that I'm trying to get to work on OS X. The data files are stored on a Windows file share so multiple users can access the same data (I'm not concerned about concurrency issues here).

I can't seem to get the mac version load the files from the server - it seems to automatically preppend the local path to whatever I set in the TClientDataset.Filename property.

If I copy the datafiles into the app package before starting the app, it works perfectly, so I figured I'd try to copy the files in code, but I can't get that to work either - it can't find the files on the server.

TFile.Exists('smb://<servername>/<path>/Data.xml');

Returns FALSE despite the fact I can see it in Finder.

Ideally, I'd prefer to load the files from the share rather than copy them at startup and copy back on exit.

bneely
  • 9,083
  • 4
  • 38
  • 46
Joel Barker
  • 121
  • 3
  • 4
    I guess it has nothing to do with TClientDataSet. The problem seems that you cannot see the shared file from within your application. Are you aware that on Mac file names are case-sensitive? – Uwe Raabe Apr 16 '12 at 05:19

2 Answers2

1

I had a similar problem and worked it out by creating one tcp server on the windows side and one tcp client on the client side.. and sending the xml file through streams.. works like a charm ...

Tony Hanna
  • 91
  • 6
0

The biggest problem is that Mac OS does not automatic map your network folder to an local folder, windows virtualy does this for you even if you don't map your drive so all files is temp copyed to a virtual space and thats why you can use it direct from your application on windows without map the network folder.

So to solve that problem you will need to mount your share to some folder using something like this:

mkdir /Volumes/WinShareName mount WinShareName "cifs://server/share"

So after that you could use the TFile.Exists('/Volumes/WinShareName/Data.xml'); Or load it directly from clientedataset.loadfromfile.

I just could'nt test it because I'm without an mac machine now but thats the main idea.

UPDATED ---- You can see more examples on how to mount an network driver here

Community
  • 1
  • 1
Diego Garcia
  • 1,134
  • 1
  • 12
  • 25