Setting the tmp-path in OgreDeflate

What it says on the tin: a place to discuss proposed new features.

Setting the tmp-path in OgreDeflate

Postby Doc_QuicknDirty » Mon Dec 05, 2011 7:43 pm

Hi there,

I had some massive problems with OgreDeflate under Windows 7.

At line 118 it creates a temporary file by using std::tmpname(). tmpname() will retrun something like "/s03g.". But in windows / is the disk volume root directory. When running Ogre from my D: partition Deflate could create temporary files, but could not delete them. When running Ogre from C: Windows blocked creating files in C:/ generally and my app crashed.

My workaround was to add the following:
Code: Select all
117   // Write to temp file
118   char tmpname[L_tmpnam];
119   tmpnam(tmpname);
120   #ifdef _WIN32
121   if(tmpname[0] == '\\')
122   {
123      for(int i = 1; i < L_tmpnam; i++)
124         {
125            tmpname[i - 1] = tmpname[i];
126        }
127        tmpname[L_tmpnam - 1] = -52;
128    }
129   #endif
130   mTempFileName = tmpname;
131   std::fstream *f = OGRE_NEW_T(std::fstream, MEMCATEGORY_GENERAL)();
132   f->open(tmpname, std::ios::binary | std::ios::out);
133   ...


Now it writes the temporary files to the working directory.

My suggestion is to add a possibility to specify a path for the temporary files. If you work a lot with deflate you could than use a RAM-disk e.g.

Best wishes

Ralf

For this message the author Doc_QuicknDirty has received kudos
Doc_QuicknDirty
Gnoblar
 
Posts: 16
Kudos: 1
Joined: 30 Aug 2010

Re: Setting the tmp-path in OgreDeflate

Postby arcanemartz » Fri Jun 29, 2012 6:09 am

In case other end up here after encountering that problem, I posted a patch on the bug tracker:

http://sourceforge.net/tracker/?func=detail&aid=3538259&group_id=2997&atid=302997

For this message the author arcanemartz has received kudos
User avatar
arcanemartz
Gnoblar
 
Posts: 6
Kudos: 3
Joined: 26 Jun 2012

Re: Setting the tmp-path in OgreDeflate

Postby jacmoe » Fri Jun 29, 2012 11:28 pm

Okay, why does the existing patch not work?
It was committed to v1-8 at April 24th this year:
-> https://bitbucket.org/sinbad/ogre/chang ... 046cb4439c
Sinbad merged it into 'default' 3 days ago. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, Fueled by Passion.
Ogre AppWizards - Ogre project wizards for VC 8-10, Code::Blocks and KDevelop.
OgreAssimpConverter - command-line to convert models to Ogre format.
TwOgreGUI - wrapper for AntTweakBar GUI library.
I accept donations | Me on Google+
User avatar
jacmoe
OGRE Moderator
OGRE Moderator
 
Posts: 21024
Kudos: 162
Joined: 22 Jan 2004
Location: Denmark

Re: Setting the tmp-path in OgreDeflate

Postby arcanemartz » Fri Jul 20, 2012 6:14 am

The patch on April 24th allows the caller to specify the temporary file.

The problem is still there when you don't specify the file.

Edit: The new submitted patch is more about that problem:
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=70625
but I though some would end up in this post (as I did) when looking for a solution.
User avatar
arcanemartz
Gnoblar
 
Posts: 6
Kudos: 3
Joined: 26 Jun 2012


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 3 guests