Screenshot cannot write to directory in Vista
by Stanley D Chatman · in Torque Game Builder · 02/11/2008 (11:13 am) · 7 replies
In Vista when you hit ctrl-p which is bound by default to the doScreenShot function it generates a file i/o write error since it cannot write to the screenshot folder.
function doScreenShot(%val)
{
// Because this can be bound to a hotkey, we make sure that %val is 1 or not specified. That
// way, the screenshot will be taken only on keydown, or when this function is called with
// no parameters.
if ((%val) || (%val $= ""))
{
if ($pref::Video::screenShotSession $= "")
$pref::Video::screenShotSession = 0;
if ($screenshotNumber == 0)
$pref::Video::screenShotSession++;
if ($pref::Video::screenShotSession > 999)
$pref::Video::screenShotSession = 1;
%name = expandFileName([b] "^game/data/screenshots/" [/b]@ formatSessionNumber($pref::Video::screenShotSession) @ "-" @
formatImageNumber($screenshotNumber) );
$screenshotNumber++;
if (($pref::Video::screenShotFormat $= "JPEG") ||
($pref::video::screenShotFormat $= "JPG"))
screenShot(%name @ ".jpg", "JPEG");
else if($pref::Video::screenShotFormat $= "PNG")
screenShot(%name @ ".png", "PNG");
else
screenShot(%name @ ".png", "PNG");
}
}
#2
02/11/2008 (11:24 am)
The folder is there by default when you create new project. The folder is located at game/data/screenshots. All games have a screenshots folder now.
#3
The only other thing I'm assuming is a flubbed permissions issue on Vista, I'll pass this along.
02/11/2008 (12:32 pm)
Interesting--I checked that myself before I asked, and didn't have one, so unsure :)The only other thing I'm assuming is a flubbed permissions issue on Vista, I'll pass this along.
#4
That worked for me. I had tried:
02/12/2008 (2:23 pm)
Try changing the directory name in doScreenShot() to:%name = expandFileName( "~/../game/data/screenshots/" @ ...
That worked for me. I had tried:
%name = expandFileName( "~/data/screenshots/" @ ...but that (unexpectedly?) saved the screenshot in common/data/screenshots/001-00000.png.
#6
02/12/2008 (5:09 pm)
No, sorry. Mac OS 10.5.2
Torque 3D Owner Stephen Zepp