Intrafoundation Software
Making Atomic Warfare Fun Again
 

Need a shoulder to cry on while trying to convince Windows to properly work with our software? Just want to chat about something related to the site? Feel free to use the forums slash news slash blog.

(Unsolicited commercial spam will be deleted, obviously.)

[Looking for something?]
Looking for something?
This is thread 231. The complete list of threads is available on the main forums page.
Subject: CFX_IMageInfo leaving directory in use?
Author: Steve Hammonds
Date/Time: 9/24/2003 11:51:16 AM (231.0)
I have a template that loops over a directory structure and uses CFX_IMageInfo to retrieve information for the images in the directory. If the image height is greater than the width I cfexecute to irfanview and rotate the image. Then I move the file using cffile and delete the directory.

The problem is that I can`t delete the directory after it has been emptied, even manually. I get a sharing violation and I am told that the directory is in use. I have commented out portions of my code and am left to conclude that CFX_ImageINfo is somehow causing Cold Fusion to leave the directory in use. Restarting CF releases the directory and I can delete it. I checked CF administrator and I am am NOT keeping the CFX_IMageInfo library loaded.

We are running CF 4.5 and the server is Windows 2000 with IIS.

Any tips, comments??
Subject: RE:more information
Author:
Date/Time: 9/24/2003 11:52:06 AM (232.231)
Here`s some code that can reproduce the problem:

<!--- directory strucuture
root
folder1
image file
--->
<cfset rootdir=`d:\cfusion\template\cfpro\equipment\drawings\test\root2`>
<cfset movedir=`d:\cfusion\template\cfpro\equipment\drawings\test\dest`>
<cfdirectory action=`list` name=`thefolders` directory=`#rootdir#`>
<cfdump var=`#thefolders#`>
<cfloop query=`thefolders`>
<cfif not comparenocase(type,`dir`) and comparenocase(name,`.`) and comparenocase(name,`..`)>

<CFX_ImageInfo folder=`#rootdir#\#name#\` filter=`*.tif`>
<cfdump var=`#imageinfo#`>
<cfif len(imageinfoerror) is 0><!--- got some files --->
<cfset dirname=name>
<cfloop query=`imageinfo`>
<cffile action=`MOVE` source=`#rootdir#\#dirname#\#file#` destination=`#movedir#\#file#`>
</cfloop>
<cfdirectory action=`delete` directory=`#rootdir#\#name#`>
</cfif>
</cfif>
</cfloop>
Subject: RE:CFX_IMageInfo leaving directory in use?
Author: Steve Hammonds
Date/Time: 9/24/2003 2:35:10 PM (233.231)
Fixed it!

The source code was graciously included with the custom tag. In the request.cpp file you make a call to ImageInfo. ImageInfo declares a HANDLE called hFolder that never gets released. I added `FindClose(hFolder);` to the end of ImageInfo function and recompiled. I had to restart the cold Fusion server for it to recognize the new dll file but the problem is solved!
Subject: RE:CFX_IMageInfo leaving directory in use?
Author: Lewis Sellers
Date/Time: 10/2/2003 8:01:31 PM (234.231)
Hello.

Been rather busy of late so didn`t seen your post till now. Sorry. But that`s also the thing I love most about open source -- sometimes problems can fix themselves (sort of). :)

Anyway, will fix the bug in the version downloadable on this site and add you the credits (like I do everyone that posts a bug fix.)

Thanks. Sorry about the hassle though.

--min


REPLY
Author:
Subject:
Your
Message:
Email: (optional)
(Note: For safety all HTML in your message text may be printed exactly as you typed it.)
top