summaryrefslogtreecommitdiff
path: root/indra/newview/llfloateruipreview.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-12-11 01:42:52 +0200
committerGitHub <noreply@github.com>2025-12-11 01:42:52 +0200
commitc92b0b74cbd963cd79d1cb7754256b801f1479b1 (patch)
tree5f3cf34559856bdafd950acf0c9a4d6dec59f0bc /indra/newview/llfloateruipreview.cpp
parentdbbce566e7d66c907dde7bd6c4212b0954b9a5e1 (diff)
Revert #4899 "Add more functionality to LLFile and cleanup LLAPRFile"
Interferes with linux work, will be moved to a different branch and applied separately.
Diffstat (limited to 'indra/newview/llfloateruipreview.cpp')
-rw-r--r--[-rwxr-xr-x]indra/newview/llfloateruipreview.cpp37
1 files changed, 20 insertions, 17 deletions
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 0bf0946c42..c3bc24c6b9 100755..100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -484,47 +484,47 @@ bool LLFloaterUIPreview::postBuild()
bool found_en_us = false;
std::string language_directory;
std::string xui_dir = get_xui_dir(); // directory containing localizations -- don't forget trailing delim
- mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
+ mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
LLDirIterator iter(xui_dir, "*");
- while (found) // for every directory
+ while(found) // for every directory
{
- if ((found = iter.next(language_directory))) // get next directory
+ if((found = iter.next(language_directory))) // get next directory
{
std::string full_path = gDirUtilp->add(xui_dir, language_directory);
- if (!LLFile::isdir(full_path.c_str())) // if it's not a directory, skip it
+ if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it
{
continue;
}
- if (strncmp("template",language_directory.c_str(), 8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory
+ if(strncmp("template",language_directory.c_str(),8) && -1 == language_directory.find(".")) // if it's not the template directory or a hidden directory
{
- if (!strncmp("en",language_directory.c_str(), 5)) // remember if we've seen en, so we can make it default
+ if(!strncmp("en",language_directory.c_str(),5)) // remember if we've seen en, so we can make it default
{
found_en_us = true;
}
else
{
- mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu
+ mLanguageSelection->add(std::string(language_directory)); // add it to the language selection dropdown menu
mLanguageSelection_2->add(std::string(language_directory));
}
}
}
}
- if (found_en_us)
+ if(found_en_us)
{
- mLanguageSelection->add(std::string("en"), ADD_TOP); // make en first item if we found it
- mLanguageSelection_2->add(std::string("en"), ADD_TOP);
+ mLanguageSelection->add(std::string("en"),ADD_TOP); // make en first item if we found it
+ mLanguageSelection_2->add(std::string("en"),ADD_TOP);
}
else
{
std::string warning = std::string("No EN localization found; check your XUI directories!");
popupAndPrintWarning(warning);
}
- mLanguageSelection->selectFirstItem(); // select the first item
+ mLanguageSelection->selectFirstItem(); // select the first item
mLanguageSelection_2->selectFirstItem();
- refreshList(); // refresh the list of available floaters
+ refreshList(); // refresh the list of available floaters
return true;
}
@@ -892,7 +892,8 @@ void LLFloaterUIPreview::displayFloater(bool click, S32 ID)
// Add localization to title so user knows whether it's localized or defaulted to en
std::string full_path = getLocalizedDirectory() + path;
std::string floater_lang = "EN";
- if (LLFile::isfile(full_path.c_str())) // use localized language if the file exists
+ llstat dummy;
+ if(!LLFile::stat(full_path.c_str(), &dummy)) // if the file does not exist
{
floater_lang = getLocStr(ID);
}
@@ -965,8 +966,9 @@ void LLFloaterUIPreview::onClickEditFloater()
}
file_path = getLocalizedDirectory() + file_name;
- // Does it exist? (Some localized versions may not have it when there are no diffs, and then we try to open a nonexistent file)
- if (!LLFile::isfile(file_path.c_str())) // if the file does not exist
+ // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file)
+ llstat dummy;
+ if(LLFile::stat(file_path.c_str(), &dummy)) // if the file does not exist
{
popupAndPrintWarning("No file for this floater exists in the selected localization. Opening the EN version instead.");
file_path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default
@@ -1115,14 +1117,15 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting()
std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path
bool error = false;
- if(std::string("") == path_in_textfield) // check for blank file
+ if(std::string("") == path_in_textfield) // check for blank file
{
std::string warning = "Unable to highlight differences because no file was provided; fill in the relevant text field";
popupAndPrintWarning(warning);
error = true;
}
- if (!LLFile::isfile(path_in_textfield.c_str()) && !error) // check if the file exists (empty check is redundant but useful for the informative error message)
+ llstat dummy;
+ if(LLFile::stat(path_in_textfield.c_str(), &dummy) && !error) // check if the file exists (empty check is reduntant but useful for the informative error message)
{
std::string warning = std::string("Unable to highlight differences because an invalid path to a difference file was provided:\"") + path_in_textfield + "\"";
popupAndPrintWarning(warning);