Install scripts can define a NULL path...
... don't try to call InitPath() then. Also replace more hard-coded paths. Added TODO about refactoring this code and not using hard-coded paths myself, which is no better than these scripts.
This commit is contained in:
@@ -584,15 +584,39 @@ PackageScript::DoInstall(const char* path, ItemState* state)
|
|||||||
// but it would be less save. For example, an app
|
// but it would be less save. For example, an app
|
||||||
// could have a folder named "config/be..." inside
|
// could have a folder named "config/be..." inside
|
||||||
// its installation folder.
|
// its installation folder.
|
||||||
|
// TODO: Use find_paths() or we are no better than
|
||||||
|
// these scripts.
|
||||||
script.ReplaceAll(
|
script.ReplaceAll(
|
||||||
"~/config/be",
|
"~/config/be",
|
||||||
"~/config/settings/deskbar/menu");
|
"~/config/settings/deskbar/menu");
|
||||||
script.ReplaceAll(
|
script.ReplaceAll(
|
||||||
"/boot/home/config/be",
|
"/boot/home/config/be",
|
||||||
"/boot/home/config/settings/deskbar/menu");
|
"/boot/home/config/settings/deskbar/menu");
|
||||||
|
// Rewrite all sorts of other old BeOS paths
|
||||||
|
script.ReplaceAll(
|
||||||
|
"/boot/preferences",
|
||||||
|
"/boot/system/preferences");
|
||||||
|
script.ReplaceAll(
|
||||||
|
"~/config/add-ons/Screen\\ Savers",
|
||||||
|
"~/config/non-packaged/add-ons/Screen\\ Savers");
|
||||||
|
// TODO: More. These should also be put into a
|
||||||
|
// common source location, since it can also be used
|
||||||
|
// for the retargetting of install file locations.
|
||||||
|
// Packages seem to declare which system paths they
|
||||||
|
// use, and then package items can reference one of
|
||||||
|
// those global paths by index. A more elegent solution
|
||||||
|
// compared to what happens now in InitPath() would be
|
||||||
|
// to replace those global package paths. Or maybe
|
||||||
|
// that's more fragile... but a common source for
|
||||||
|
// the rewriting of BeOS paths is needed.
|
||||||
|
|
||||||
|
printf("%s\n", script.String());
|
||||||
|
|
||||||
BPath workingDirectory;
|
BPath workingDirectory;
|
||||||
|
if (path != NULL)
|
||||||
ret = InitPath(path, &workingDirectory);
|
ret = InitPath(path, &workingDirectory);
|
||||||
|
else
|
||||||
|
ret = workingDirectory.SetTo(".");
|
||||||
if (ret == B_OK)
|
if (ret == B_OK)
|
||||||
ret = _RunScript(workingDirectory.Path(), script);
|
ret = _RunScript(workingDirectory.Path(), script);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user