changeset 12487:62e51a5413b2 octave-forge

Replace calls to canonicalize_file_name by make_absolute_filename due to changed behavior in 3.9.0+
author prnienhuis
date Wed, 21 May 2014 19:05:43 +0000
parents c915e7aa49cd
children f58870850192
files main/io/inst/private/__COM_spsh_close__.m main/io/inst/private/__COM_spsh_open__.m
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main/io/inst/private/__COM_spsh_close__.m	Thu May 15 18:54:08 2014 +0000
+++ b/main/io/inst/private/__COM_spsh_close__.m	Wed May 21 19:05:43 2014 +0000
@@ -1,4 +1,4 @@
-## Copyright (C) 2012,2013 Philip Nienhuis
+## Copyright (C) 2012,2013,2014 Philip Nienhuis
 ## 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -19,7 +19,9 @@
 ## Author: Philip Nienhuis <prnienhuis@users.sf.net>
 ## Created: 2012-10-12
 ## Updates
-## 2013-12-01 Style fixes, copyright string update
+## 2013-12-01 Style fixes, copyright string update
+## 2014-05-20 Catch changed behavior of canonicalize_file_name in 3.9.0+,
+##            replace by make_absolute_filename
 
 function [ xls ] = __COM_spsh_close__ (xls)
 
@@ -49,16 +51,17 @@
         else
           fname = xls.filename;
         endif
+        fname = make_absolute_filename (strsplit (fname, filesep){end});
         if (xls.changed == 2)
           ## Probably a newly created, or renamed, Excel file
 ##         printf ("Saving file %s ...\n", fname);
-          xls.workbook.SaveAs (canonicalize_file_name (fname));
+          xls.workbook.SaveAs (fname);
         elseif (xls.changed == 1)
           ## Just updated existing Excel file
           xls.workbook.Save ();
         endif
         xls.changed = 0;
-        xls.workbook.Close (canonicalize_file_name (fname));
+        xls.workbook.Close (fname);
       endif
       xls.app.Quit ();
       delete (xls.workbook);  ## This statement actually closes the workbook
--- a/main/io/inst/private/__COM_spsh_open__.m	Thu May 15 18:54:08 2014 +0000
+++ b/main/io/inst/private/__COM_spsh_open__.m	Wed May 21 19:05:43 2014 +0000
@@ -1,4 +1,4 @@
-## Copyright (C) 2012,2013 Philip Nienhuis
+## Copyright (C) 2012,2013,2014 Philip Nienhuis
 ## 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -22,21 +22,24 @@
 ## 2010-11-01 Added <COM>.Application.DisplayAlerts=0 in COM section to avoid Excel pop-ups
 ## 2012-10-24 Style fixes
 ## 2012-12-01 Copyright string updates
+## 2014-05-20 Catch changed behavior of canonicalize_file_name in 3.9.0+
+##            replace by make_absolute_filename
 
 function [ xls, xlssupport, lastintf ] = __COM_spsh_open__ (xls, xwrite, filename, xlssupport)
 
     app = actxserver ("Excel.Application");
     try      ## Because Excel itself can still crash on file formats etc.
       app.Application.DisplayAlerts = 0;
+      filename = make_absolute_filename (strsplit (filename, filesep){end});
       if (xwrite < 2)
         ## Open workbook
-        wb = app.Workbooks.Open (canonicalize_file_name (filename));
+        wb = app.Workbooks.Open (filename);
       elseif (xwrite > 2)
         ## Create a new workbook
         wb = app.Workbooks.Add ();
         ## Uncommenting the below statement can be useful in multi-user environments.
         ## Be sure to uncomment correspondig stanza in xlsclose to avoid zombie Excels
-        ## wb.SaveAs (canonicalize_file_name (filename))
+        ## wb.SaveAs (make_absolute_filename (strsplit (filename, filesep){end}));
       endif
       xls.app = app;
       xls.xtype = "COM";