create media settings directory before saving default nodes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22837 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,14 +3,15 @@
|
|||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <OS.h>
|
#include <Directory.h>
|
||||||
|
#include <File.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
#include <MediaRoster.h>
|
#include <MediaRoster.h>
|
||||||
|
#include <OS.h>
|
||||||
|
#include <Path.h>
|
||||||
#include <TimeSource.h>
|
#include <TimeSource.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <storage/File.h>
|
|
||||||
#include <storage/FindDirectory.h>
|
|
||||||
#include <storage/Path.h>
|
|
||||||
#include "DefaultManager.h"
|
#include "DefaultManager.h"
|
||||||
#include "DormantNodeManager.h"
|
#include "DormantNodeManager.h"
|
||||||
#include "NodeManager.h"
|
#include "NodeManager.h"
|
||||||
@@ -36,7 +37,8 @@ const char *kDefaultManagerFlavorName = "be:_flavor_name";
|
|||||||
const char *kDefaultManagerPath = "be:_path";
|
const char *kDefaultManagerPath = "be:_path";
|
||||||
const char *kDefaultManagerInput = "be:_input_id";
|
const char *kDefaultManagerInput = "be:_input_id";
|
||||||
|
|
||||||
const char *kDefaultManagerSettings = "Media/MDefaultManager";
|
const char *kDefaultManagerSettingsDirectory = "Media";
|
||||||
|
const char *kDefaultManagerSettingsFile = "MDefaultManager";
|
||||||
|
|
||||||
|
|
||||||
DefaultManager::DefaultManager()
|
DefaultManager::DefaultManager()
|
||||||
@@ -73,7 +75,8 @@ DefaultManager::LoadState()
|
|||||||
if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK)
|
if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
path.Append(kDefaultManagerSettings);
|
path.Append(kDefaultManagerSettingsDirectory);
|
||||||
|
path.Append(kDefaultManagerSettingsFile);
|
||||||
|
|
||||||
BFile file(path.Path(), B_READ_ONLY);
|
BFile file(path.Path(), B_READ_ONLY);
|
||||||
|
|
||||||
@@ -110,16 +113,18 @@ DefaultManager::SaveState(NodeManager *node_manager)
|
|||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
BPath path;
|
BPath path;
|
||||||
BList list;
|
BList list;
|
||||||
if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK)
|
if ((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path, true)) != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
path.Append(kDefaultManagerSettingsDirectory);
|
||||||
path.Append(kDefaultManagerSettings);
|
if ((err = create_directory(path.Path(), 0755)) != B_OK)
|
||||||
|
return err;
|
||||||
|
path.Append(kDefaultManagerSettingsFile);
|
||||||
|
|
||||||
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||||
|
|
||||||
uint32 default_types[] = {kMsgTypeVideoIn, kMsgTypeVideoOut, kMsgTypeAudioIn, kMsgTypeAudioOut};
|
uint32 default_types[] = {kMsgTypeVideoIn, kMsgTypeVideoOut, kMsgTypeAudioIn, kMsgTypeAudioOut};
|
||||||
uint32 media_node_ids[] = {fPhysicalVideoIn, fPhysicalVideoOut, fPhysicalAudioIn, fPhysicalAudioOut};
|
uint32 media_node_ids[] = {fPhysicalVideoIn, fPhysicalVideoOut, fPhysicalAudioIn, fPhysicalAudioOut};
|
||||||
for(uint32 i=0; i<sizeof(default_types)/sizeof(default_types[0]); i++) {
|
for (uint32 i=0; i<sizeof(default_types)/sizeof(default_types[0]); i++) {
|
||||||
BMessage *settings = new BMessage();
|
BMessage *settings = new BMessage();
|
||||||
settings->AddInt32(kDefaultManagerType, default_types[i]);
|
settings->AddInt32(kDefaultManagerType, default_types[i]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user