DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › Read only file system?
-
gcrews September 14, 2010 at 6:23 pm
Read only file system?
September 14, 2010 at 6:23 pmParticipants 3Replies 4Last Activity 12 years, 6 months agoWould Xmetal work if you’re using it to view content from a read only file system such as a cd? I don’t think the preview tab will work because Xmetal creates a HM###.xml and a ditaval file. Is there a way to tell it to generate those files to the temp dir or specified output dir instead?
Derek Read September 14, 2010 at 7:06 pm
Reply to: Read only file system?
September 14, 2010 at 7:06 pmIt might work. The code (inside multipleOutput.mcr inside the Startup folder) that decides where to create the preview files is as follows:
[code]function getPreviewPath(docPath,fileExt)
{
var fPath = “”;
try{
removeTmpPreviewFiles();
var fso = new ActiveXObject(“Scripting.FileSystemObject”);
if (docPath != “” && docPath.substr(0, 5) != “http:”){
var docPathObject = fso.GetFolder(docPath);
if (docPathObject.attributes & 1)
{ // ActiveDocument.Path is Read-Only, use css folder instead
var dir = getXMDocumentFolder();
fPath = Application.UniqueFileName(dir,”PRV”,fileExt);
}
else
fPath = Application.UniqueFileName(docPath,”PRV”,fileExt);
}
else {
var dir = getXMDocumentFolder();
fPath = Application.UniqueFileName(dir,”PRV”,fileExt);
}
}
catch(e){
}
if (fPath != “”) gTmpPrviewFile.push(fPath);
return fPath;
}[/code]If the Windows File System Object tells that code the path is read-only the logic is supposed to save the temp files to the same folder as the CSS file (typically included with the customization). You can check the path that XMetaL is going to try to save to by running this:
[code]//XMetaL Script Language JScript:
var dir = getPreviewPath(ActiveDocument.Path,”.xml”);
Application.Alert(dir);[/code]Derek Read September 14, 2010 at 7:26 pm
Reply to: Read only file system?
September 14, 2010 at 7:26 pmLooks like there's more involved here than I thought. A quick test on a write protected floppy shows it fails when attempting to write the temporary XML file (and an error is raised). I assume a CD would be similar behavior. Tested with XMetaL Author Enterprise 6.0.1.030 (I think 6.0 might have a slightly different multipleOutput.mcr file than previous versions).
My steps:
1. Save a file to floppy.
2. Write protect the floppy.
3. Switch to Browser Preview and wait for about 5 minutes.
Windows eventually figures out it can't write there, at which point the XMetaL script fails and raises an error like this:---------------------------
XMetaL Author Enterprise
---------------------------
Could not open a:HM49A.xml for writing : Permission denied.Check the directory and file names and try the operation again.
---------------------------
OK
---------------------------Probably best that I just escalate this as a feature request at this point (although you are free to go in and modify this behavior in the MCR file you'd be on your own there). Can I ask why you need this feature to put it into context when I make my write-up?
gcrews September 14, 2010 at 8:03 pm
Reply to: Read only file system?
September 14, 2010 at 8:03 pmThanks for the help; I have looked at that code before in multipleOutput.mcr. I think that stuff only gets run when you use the preview html in a meeting file. It looks like that file is created by DitaRenditions.js in DitaRenditionsImpl.prototype.SaveAsHtmlPdf. I think I have my answer to my questions.
Derek Read September 14, 2010 at 8:16 pm
Reply to: Read only file system?
September 14, 2010 at 8:16 pmYes sorry. I've re-read your thread and clued into the fact that you're talking about DITA documents. The preview functionality there is very different and not connected to multipleOutput.mcr (that is something we include for use by people creating their own customizations and will run for anything BUT DITA by default).
For DITA when you switch views to Browser Preview the code (which runs the DITA OT) assumes at first that you want to generate output to the same folder as the DITA source files, which in your case (and with my locked floppy) is read only and it will fail. When you switch directly to Browser Preview the default location is assumed.
However, with DITA you also have the option to select Generate Output from the File menu. You can specify an alternative location in “Save output as”. If you do that it will work (provided your output location is write permitted).
I'll log this as the real request. If the location is found to be read-only one option would be to prompt the user for an alternate location.
-
AuthorPosts
- You must be logged in to reply to this topic.