Skip to content

Commit

Permalink
Use find_directory to find the location of settings and backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
atx committed Dec 24, 2014
1 parent ebffae4 commit 57e021e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
19 changes: 9 additions & 10 deletions source/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <Directory.h>
#include <LayoutBuilder.h>
#include <Box.h>
#include <FindDirectory.h>
#include "AboutWindow.h"
#include "Preferences.h"
#include "TileView.h"
Expand Down Expand Up @@ -46,16 +47,14 @@ MainWindow::MainWindow(void)
fGrid(NULL),
fWorkGrid(NULL)
{
app_info ai;
be_app->GetAppInfo(&ai);
BPath path(&ai.ref);
path.GetParent(&path);
path.Append("backgrounds");
fBackPath = path.Path();
fBackPath << "/";

BPath path;
find_directory(B_USER_SETTINGS_DIRECTORY, &path);
path.Append("BeVexed");
fBackPath = BString(path.Path()) << "/backgrounds/";
fPrefPath = BString(path.Path()) << "/settings";

static const rgb_color beos_blue = {51,102,152,255};
LoadPreferences(PREFERENCES_PATH);
LoadPreferences(fPrefPath);

if(gPreferences.FindInt8("gridsize",(int8*)&fGridSize)!=B_OK)
{
Expand Down Expand Up @@ -202,7 +201,7 @@ MainWindow::MainWindow(void)
bool MainWindow::QuitRequested(void)
{
gPreferences.ReplacePoint("corner",Frame().LeftTop());
SavePreferences(PREFERENCES_PATH);
SavePreferences(fPrefPath);
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
Expand Down
1 change: 1 addition & 0 deletions source/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class MainWindow : public BWindow
uint8 fTileSize;

BString fBackPath;
BString fPrefPath;
BString fBackName;
};

Expand Down
2 changes: 0 additions & 2 deletions source/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ extern BLocker prefsLock;
extern BMessage gPreferences;
extern BString gAppPath;

#define PREFERENCES_PATH "/boot/home/config/settings/BeVexed"

status_t SavePreferences(const char *path);
status_t LoadPreferences(const char *path);

Expand Down

0 comments on commit 57e021e

Please sign in to comment.