WriteFile with same document name, rhino common

Hello Forum,

I’m using this code to save my document:

bool ok = RhinoDoc.ActiveDoc.WriteFile(filenameWithPath, options);

It works well except when the given filename is the same of the document filename. To make it short it fails when used as a simple “Save” command. I guess the reason is that the system tries to write to a file which is of course open.

Is there any workaround for this situation?

Thanks! Livio

RhinoApp.RunScript("_-Save")

It will save the current file.