summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2011-10-29 11:24:29 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2011-10-29 11:24:29 +0000
commit62900af515dbdf447f3c0c6b07207c72682d3461 (patch)
treee5ae5327e1041d749899797e9eabb0a47c3b19c7 /amiga
parent4abaf2f0857efbd700b7c31bd3fc4856613aa3ce (diff)
downloadnetsurf-62900af515dbdf447f3c0c6b07207c72682d3461.tar.gz
netsurf-62900af515dbdf447f3c0c6b07207c72682d3461.tar.bz2
Search the current theme dir for resources.
svn path=/trunk/netsurf/; revision=13091
Diffstat (limited to 'amiga')
-rwxr-xr-xamiga/gui.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index df96e8bee..0f4733fb9 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -209,13 +209,30 @@ STRPTR ami_locale_langs(void)
return acceptlangs;
}
-bool ami_locate_resource(char *lang, const char *file)
+bool ami_locate_resource(char *fullpath, const char *file)
{
struct Locale *locale;
int i;
BPTR lock = 0;
bool found = false;
+ /* Firstly check the user's selected theme. NB: ami_locate_resource()
+ * gets called for Messages before options are loaded */
+
+ if(option_theme)
+ {
+ strcpy(fullpath, option_theme);
+ path_add_part(fullpath, 1024, file);
+
+ if(lock = Lock(fullpath, ACCESS_READ))
+ {
+ UnLock(lock);
+ return true;
+ }
+ }
+
+ /* If not found, start on the user's preferred languages */
+
if(lock=Lock("PROGDIR:Resources/LangNames",ACCESS_READ))
{
UnLock(lock);
@@ -226,19 +243,19 @@ bool ami_locate_resource(char *lang, const char *file)
for(i=0;i<10;i++)
{
- strcpy(lang,"PROGDIR:Resources/");
+ strcpy(fullpath,"PROGDIR:Resources/");
if(locale->loc_PrefLanguages[i])
{
- strcat(lang,messages_get(locale->loc_PrefLanguages[i]));
+ strcat(fullpath,messages_get(locale->loc_PrefLanguages[i]));
}
else
{
continue;
}
- strcat(lang, "/");
- strcat(lang, file);
+ strcat(fullpath, "/");
+ strcat(fullpath, file);
- if(lock=Lock(lang,ACCESS_READ))
+ if(lock=Lock(fullpath,ACCESS_READ))
{
UnLock(lock);
found = true;
@@ -251,10 +268,10 @@ bool ami_locate_resource(char *lang, const char *file)
/* If not found yet, check in PROGDIR:Resources/en,
* might not be in user's preferred languages */
- strcpy(lang, "PROGDIR:Resources/en/");
- strcat(lang, file);
+ strcpy(fullpath, "PROGDIR:Resources/en/");
+ strcat(fullpath, file);
- if(lock=Lock(lang, ACCESS_READ))
+ if(lock=Lock(fullpath, ACCESS_READ))
{
UnLock(lock);
found = true;
@@ -268,10 +285,10 @@ bool ami_locate_resource(char *lang, const char *file)
{
/* Lastly check directly in PROGDIR:Resources */
- strcpy(lang, "PROGDIR:Resources/");
- strcat(lang, file);
+ strcpy(fullpath, "PROGDIR:Resources/");
+ strcat(fullpath, file);
- if(lock=Lock(lang, ACCESS_READ))
+ if(lock=Lock(fullpath, ACCESS_READ))
{
UnLock(lock);
found = true;