Filter löschen
Filter löschen

implementing chroot in matlab for input/output files

2 Ansichten (letzte 30 Tage)
user001
user001 am 10 Nov. 2017
I have written scripts designed to be run on machine A. I would now like to run them on machine B which has machine A's file system mounted via sshfs at `/path/to/A`, without making any changes to the scripts themselves.
Essentially, I would like to do what unix's chroot does but for user (non-system) files in Matlab. Specifically, I would like to provide the new root (/path/to/A) and have this be prepended to any files opened for reading/writing (in my case, text and image files). Of course, I could pass a string defining the "path to root" for each machine ('/' on machine A and '/path/to/A' on machine B), and then modify the code so that this string is prepended to each path, but I am hoping to find an intrinsic or FEX solution that does this transparently without me having to rewrite each line that involves a file path. Note that I want these changes to apply only to files in "user space" (from a Matlab point of view) and not to any Matlab system files on either machine. I don't have root privileges on machine B so I cannot simply symlink the directories used on file system A so that they point to the same place on machine B. Also because there are embedded include files (matlab scripts) that are generated dynamically by other processes and which themselves contain paths, I cannot simply use `sed` to correct all paths in the main script. Thanks in advance for any tips.

Antworten (0)

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by