use find_directory() instead of /boot/home/
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25373 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,10 +19,12 @@
|
|||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <MessageQueue.h>
|
#include <MessageQueue.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
|
#include <Path.h>
|
||||||
#include <PropertyInfo.h>
|
#include <PropertyInfo.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
@@ -3248,15 +3250,23 @@ BWindow::_HandleKeyDown(BMessage* event)
|
|||||||
int32 rawKey;
|
int32 rawKey;
|
||||||
if (event->FindInt32("key", &rawKey) == B_OK && rawKey == B_PRINT_KEY) {
|
if (event->FindInt32("key", &rawKey) == B_OK && rawKey == B_PRINT_KEY) {
|
||||||
// Get filename
|
// Get filename
|
||||||
char filename[128];
|
BPath homePath;
|
||||||
BEntry entry;
|
|
||||||
|
|
||||||
|
if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK) {
|
||||||
|
fprintf(stderr, "failed to find user home directory\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
BPath path;
|
||||||
|
BEntry entry;
|
||||||
int32 index = 1;
|
int32 index = 1;
|
||||||
do {
|
do {
|
||||||
// TODO: Use find_directory(B_USER_DIRECTORY, ...)
|
char filename[32];
|
||||||
sprintf(filename, "/boot/home/screen%ld.png", index++);
|
sprintf(filename, "screen%ld.png", index++);
|
||||||
entry.SetTo(filename);
|
path = homePath;
|
||||||
} while(entry.Exists());
|
path.Append(filename);
|
||||||
|
entry.SetTo(path.Path());
|
||||||
|
} while (entry.Exists());
|
||||||
|
|
||||||
// Get the screen bitmap
|
// Get the screen bitmap
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
@@ -3264,7 +3274,7 @@ BWindow::_HandleKeyDown(BMessage* event)
|
|||||||
screen.GetBitmap(&screenDump, false);
|
screen.GetBitmap(&screenDump, false);
|
||||||
|
|
||||||
// Dump to PNG
|
// Dump to PNG
|
||||||
SaveToPNG(filename, screen.Frame(), screenDump->ColorSpace(),
|
SaveToPNG(path.Path(), screen.Frame(), screenDump->ColorSpace(),
|
||||||
screenDump->Bits(),
|
screenDump->Bits(),
|
||||||
screenDump->BitsLength(),
|
screenDump->BitsLength(),
|
||||||
screenDump->BytesPerRow());
|
screenDump->BytesPerRow());
|
||||||
|
|||||||
Reference in New Issue
Block a user