I have a class which I want to create a write
method for which at the moment looks like this:
write {
arg path;
var outPath, outFile;
outPath = PathName.new(path);
this.traverse(this);
outFile = File.new("~/foo.rpp".standardizePath, 'w');
outFile.close;
}
Eventually "~/foo.rpp"
will be replaced by outPath, however, this current code calls an error when I try to run the write method.
ERROR: Primitive '_FileOpen' failed.
Wrong type.
RECEIVER:
Instance of File { (0x7fe6aa89f5e8, gc=88, fmt=00, flg=00, set=02)
instance variables [1]
fileptr : nil
}
I’ve tried this on both MacOS and windows to rule out any basic errors with my build on the M1 Macbook but I get the same error on both. If I make a fairly comparable bit of code outside of the class and in the language it works. Example is here:
(
x = File.new("~/foo.rpp".standardizePath, "w"):
x.close;
)
Can anyone point me to where I am thinking about this poorly or incorrectly?