Changeset 25373

Show
Ignore:
Timestamp:
05/08/08 09:10:09 (7 months ago)
Author:
korli
Message:

use find_directory() instead of /boot/home/

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • haiku/trunk/src/kits/interface/Window.cpp

    r25269 r25373  
    2020#include <Bitmap.h> 
    2121#include <Button.h> 
     22#include <FindDirectory.h> 
    2223#include <MenuBar.h> 
    2324#include <MenuItem.h> 
    2425#include <MessageQueue.h> 
    2526#include <MessageRunner.h> 
     27#include <Path.h> 
    2628#include <PropertyInfo.h> 
    2729#include <Roster.h> 
     
    32493251                if (event->FindInt32("key", &rawKey) == B_OK && rawKey == B_PRINT_KEY) { 
    32503252                        // Get filename 
    3251                         char filename[128]; 
     3253                        BPath homePath; 
     3254 
     3255                        if (find_directory(B_USER_DIRECTORY, &homePath) != B_OK) { 
     3256                                fprintf(stderr, "failed to find user home directory\n"); 
     3257                                return true; 
     3258                        } 
     3259 
     3260                        BPath path; 
    32523261                        BEntry entry; 
    3253  
    32543262                        int32 index = 1; 
    32553263                        do { 
    3256                                 // TODO: Use find_directory(B_USER_DIRECTORY, ...) 
    3257                                 sprintf(filename, "/boot/home/screen%ld.png", index++); 
    3258                                 entry.SetTo(filename); 
    3259                         } while(entry.Exists()); 
     3264                                char filename[32]; 
     3265                                sprintf(filename, "screen%ld.png", index++); 
     3266                                path = homePath; 
     3267                                path.Append(filename); 
     3268                                entry.SetTo(path.Path()); 
     3269                        } while (entry.Exists()); 
    32603270 
    32613271                        // Get the screen bitmap 
     
    32653275 
    32663276                        // Dump to PNG 
    3267                         SaveToPNG(filename, screen.Frame(), screenDump->ColorSpace(), 
     3277                        SaveToPNG(path.Path(), screen.Frame(), screenDump->ColorSpace(), 
    32683278                                screenDump->Bits(), 
    32693279                                screenDump->BitsLength(),