Skip to content

Commit

Permalink
Remove AddFileFolder(..) without return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawk committed May 7, 2013
1 parent 20a5367 commit a115d4f
Show file tree
Hide file tree
Showing 36 changed files with 121 additions and 176 deletions.
3 changes: 1 addition & 2 deletions xbmc/Application.cpp
Expand Up @@ -1808,8 +1808,7 @@ void CApplication::LoadSkin(const SkinPtr& skin)
g_fontManager.LoadFonts(CSettings::Get().GetString("lookandfeel.font"));

// load in the skin strings
CStdString langPath;
URIUtils::AddFileToFolder(skin->Path(), "language", langPath);
CStdString langPath = URIUtils::AddFileToFolder(skin->Path(), "language");
URIUtils::AddSlashAtEnd(langPath);

g_localizeStrings.LoadSkinStrings(langPath, CSettings::Get().GetString("locale.language"));
Expand Down
2 changes: 1 addition & 1 deletion xbmc/CueDocument.cpp
Expand Up @@ -362,7 +362,7 @@ bool CCueDocument::ResolvePath(CStdString &strPath, const CStdString &strBase)

CStdString strFilename = URIUtils::GetFileName(strPath);

URIUtils::AddFileToFolder(strDirectory, strFilename, strPath);
strPath = URIUtils::AddFileToFolder(strDirectory, strFilename);

// i *hate* windows
if (!CFile::Exists(strPath))
Expand Down
4 changes: 2 additions & 2 deletions xbmc/Favourites.cpp
Expand Up @@ -40,7 +40,7 @@ bool CFavourites::Load(CFileItemList &items)
CFavourites::LoadFavourites(favourites, items);
else
CLog::Log(LOGDEBUG, "CFavourites::Load - no system favourites found, skipping");
URIUtils::AddFileToFolder(CProfilesManager::Get().GetProfileUserDataFolder(), "favourites.xml", favourites);
favourites = URIUtils::AddFileToFolder(CProfilesManager::Get().GetProfileUserDataFolder(), "favourites.xml");
if(XFILE::CFile::Exists(favourites))
CFavourites::LoadFavourites(favourites, items);
else
Expand Down Expand Up @@ -108,7 +108,7 @@ bool CFavourites::Save(const CFileItemList &items)
rootNode->InsertEndChild(favNode);
}

URIUtils::AddFileToFolder(CProfilesManager::Get().GetProfileUserDataFolder(), "favourites.xml", favourites);
favourites = URIUtils::AddFileToFolder(CProfilesManager::Get().GetProfileUserDataFolder(), "favourites.xml");
return doc.SaveFile(favourites);
}

Expand Down
38 changes: 18 additions & 20 deletions xbmc/FileItem.cpp
Expand Up @@ -2321,27 +2321,27 @@ void CFileItemList::StackFolders()
{
CStdString path;
CStdString dvdPath;
URIUtils::AddFileToFolder(item->GetPath(), "VIDEO_TS.IFO", path);
path = URIUtils::AddFileToFolder(item->GetPath(), "VIDEO_TS.IFO");
if (CFile::Exists(path))
dvdPath = path;
else
{
URIUtils::AddFileToFolder(item->GetPath(), "VIDEO_TS", dvdPath);
URIUtils::AddFileToFolder(dvdPath, "VIDEO_TS.IFO", path);
dvdPath = URIUtils::AddFileToFolder(item->GetPath(), "VIDEO_TS");
path = URIUtils::AddFileToFolder(dvdPath, "VIDEO_TS.IFO");
dvdPath.Empty();
if (CFile::Exists(path))
dvdPath = path;
}
#ifdef HAVE_LIBBLURAY
if (dvdPath.IsEmpty())
{
URIUtils::AddFileToFolder(item->GetPath(), "index.bdmv", path);
path = URIUtils::AddFileToFolder(item->GetPath(), "index.bdmv");
if (CFile::Exists(path))
dvdPath = path;
else
{
URIUtils::AddFileToFolder(item->GetPath(), "BDMV", dvdPath);
URIUtils::AddFileToFolder(dvdPath, "index.bdmv", path);
dvdPath = URIUtils::AddFileToFolder(item->GetPath(), "BDMV");
path = URIUtils::AddFileToFolder(dvdPath, "index.bdmv");
dvdPath.Empty();
if (CFile::Exists(path))
dvdPath = path;
Expand Down Expand Up @@ -2685,19 +2685,19 @@ CStdString CFileItem::GetTBNFile() const
URIUtils::GetParentPath(m_strPath,strPath);
CFileItem item(CStackDirectory::GetFirstStackedFile(strFile),false);
CStdString strTBNFile = item.GetTBNFile();
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strTBNFile),strReturn);
strReturn = URIUtils::AddFileToFolder(strPath, URIUtils::GetFileName(strTBNFile));
if (CFile::Exists(strReturn))
return strReturn;

URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(strFile)),strFile);
strFile = URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(strFile)));
}

if (URIUtils::IsInRAR(strFile) || URIUtils::IsInZIP(strFile))
{
CStdString strPath, strParent;
URIUtils::GetDirectory(strFile,strPath);
URIUtils::GetParentPath(strPath,strParent);
URIUtils::AddFileToFolder(strParent,URIUtils::GetFileName(m_strPath),strFile);
strFile = URIUtils::AddFileToFolder(strParent, URIUtils::GetFileName(m_strPath));
}

CURL url(strFile);
Expand Down Expand Up @@ -2766,15 +2766,15 @@ CStdString CFileItem::GetLocalArt(const std::string &artFile, bool useFolder) co
*/
CStdString strPath;
URIUtils::GetParentPath(m_strPath,strPath);
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(strFile)),strFile);
strFile = URIUtils::AddFileToFolder(strPath, URIUtils::GetFileName(CStackDirectory::GetStackedTitlePath(strFile)));
}

if (URIUtils::IsInRAR(strFile) || URIUtils::IsInZIP(strFile))
{
CStdString strPath, strParent;
URIUtils::GetDirectory(strFile,strPath);
URIUtils::GetParentPath(strPath,strParent);
URIUtils::AddFileToFolder(strParent,URIUtils::GetFileName(strFile),strFile);
strFile = URIUtils::AddFileToFolder(strParent, URIUtils::GetFileName(strFile));
}

if (IsMultiPath())
Expand Down Expand Up @@ -2808,7 +2808,6 @@ CStdString CFileItem::GetLocalArt(const std::string &artFile, bool useFolder) co

CStdString CFileItem::GetFolderThumb(const CStdString &folderJPG /* = "folder.jpg" */) const
{
CStdString folderThumb;
CStdString strFolder = m_strPath;

if (IsStack() ||
Expand All @@ -2821,8 +2820,7 @@ CStdString CFileItem::GetFolderThumb(const CStdString &folderJPG /* = "folder.jp
if (IsMultiPath())
strFolder = CMultiPathDirectory::GetFirstPath(m_strPath);

URIUtils::AddFileToFolder(strFolder, folderJPG, folderThumb);
return folderThumb;
return URIUtils::AddFileToFolder(strFolder, folderJPG);
}

CStdString CFileItem::GetMovieName(bool bUseFolderNames /* = false */) const
Expand Down Expand Up @@ -2895,17 +2893,17 @@ CStdString CFileItem::GetLocalFanart() const
CStackDirectory dir;
CStdString strPath2;
strPath2 = dir.GetStackedTitlePath(strFile);
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strPath2),strFile);
strFile = URIUtils::AddFileToFolder(strPath, URIUtils::GetFileName(strPath2));
CFileItem item(dir.GetFirstStackedFile(m_strPath),false);
CStdString strTBNFile(URIUtils::ReplaceExtension(item.GetTBNFile(), "-fanart"));
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strTBNFile),strFile2);
strFile2 = URIUtils::AddFileToFolder(strPath, URIUtils::GetFileName(strTBNFile));
}
if (URIUtils::IsInRAR(strFile) || URIUtils::IsInZIP(strFile))
{
CStdString strPath, strParent;
URIUtils::GetDirectory(strFile,strPath);
URIUtils::GetParentPath(strPath,strParent);
URIUtils::AddFileToFolder(strParent,URIUtils::GetFileName(m_strPath),strFile);
strFile = URIUtils::AddFileToFolder(strParent, URIUtils::GetFileName(m_strPath));
}

// no local fanart available for these
Expand Down Expand Up @@ -3151,17 +3149,17 @@ CStdString CFileItem::FindTrailer() const
CStackDirectory dir;
CStdString strPath2;
strPath2 = dir.GetStackedTitlePath(strFile);
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strPath2),strFile);
strFile = URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strPath2));
CFileItem item(dir.GetFirstStackedFile(m_strPath),false);
CStdString strTBNFile(URIUtils::ReplaceExtension(item.GetTBNFile(), "-trailer"));
URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strTBNFile),strFile2);
strFile2 = URIUtils::AddFileToFolder(strPath,URIUtils::GetFileName(strTBNFile));
}
if (URIUtils::IsInRAR(strFile) || URIUtils::IsInZIP(strFile))
{
CStdString strPath, strParent;
URIUtils::GetDirectory(strFile,strPath);
URIUtils::GetParentPath(strPath,strParent);
URIUtils::AddFileToFolder(strParent,URIUtils::GetFileName(m_strPath),strFile);
strFile = URIUtils::AddFileToFolder(strParent,URIUtils::GetFileName(m_strPath));
}

// no local trailer available for these
Expand Down
46 changes: 19 additions & 27 deletions xbmc/Util.cpp
Expand Up @@ -1318,56 +1318,49 @@ int CUtil::GetMatchingSource(const CStdString& strPath1, VECSOURCES& VECSOURCES,

CStdString CUtil::TranslateSpecialSource(const CStdString &strSpecial)
{
CStdString strReturn=strSpecial;
if (!strSpecial.IsEmpty() && strSpecial[0] == '$')
{
if (strSpecial.Left(5).Equals("$HOME"))
URIUtils::AddFileToFolder("special://home/", strSpecial.Mid(5), strReturn);
return URIUtils::AddFileToFolder("special://home/", strSpecial.Mid(5));
else if (strSpecial.Left(10).Equals("$SUBTITLES"))
URIUtils::AddFileToFolder("special://subtitles/", strSpecial.Mid(10), strReturn);
return URIUtils::AddFileToFolder("special://subtitles/", strSpecial.Mid(10));
else if (strSpecial.Left(9).Equals("$USERDATA"))
URIUtils::AddFileToFolder("special://userdata/", strSpecial.Mid(9), strReturn);
return URIUtils::AddFileToFolder("special://userdata/", strSpecial.Mid(9));
else if (strSpecial.Left(9).Equals("$DATABASE"))
URIUtils::AddFileToFolder("special://database/", strSpecial.Mid(9), strReturn);
return URIUtils::AddFileToFolder("special://database/", strSpecial.Mid(9));
else if (strSpecial.Left(11).Equals("$THUMBNAILS"))
URIUtils::AddFileToFolder("special://thumbnails/", strSpecial.Mid(11), strReturn);
return URIUtils::AddFileToFolder("special://thumbnails/", strSpecial.Mid(11));
else if (strSpecial.Left(11).Equals("$RECORDINGS"))
URIUtils::AddFileToFolder("special://recordings/", strSpecial.Mid(11), strReturn);
return URIUtils::AddFileToFolder("special://recordings/", strSpecial.Mid(11));
else if (strSpecial.Left(12).Equals("$SCREENSHOTS"))
URIUtils::AddFileToFolder("special://screenshots/", strSpecial.Mid(12), strReturn);
return URIUtils::AddFileToFolder("special://screenshots/", strSpecial.Mid(12));
else if (strSpecial.Left(15).Equals("$MUSICPLAYLISTS"))
URIUtils::AddFileToFolder("special://musicplaylists/", strSpecial.Mid(15), strReturn);
return URIUtils::AddFileToFolder("special://musicplaylists/", strSpecial.Mid(15));
else if (strSpecial.Left(15).Equals("$VIDEOPLAYLISTS"))
URIUtils::AddFileToFolder("special://videoplaylists/", strSpecial.Mid(15), strReturn);
return URIUtils::AddFileToFolder("special://videoplaylists/", strSpecial.Mid(15));
else if (strSpecial.Left(7).Equals("$CDRIPS"))
URIUtils::AddFileToFolder("special://cdrips/", strSpecial.Mid(7), strReturn);
return URIUtils::AddFileToFolder("special://cdrips/", strSpecial.Mid(7));
// this one will be removed post 2.0
else if (strSpecial.Left(10).Equals("$PLAYLISTS"))
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), strSpecial.Mid(10), strReturn);
return URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), strSpecial.Mid(10));
}
return strReturn;
return strSpecial;
}

CStdString CUtil::MusicPlaylistsLocation()
{
vector<CStdString> vec;
CStdString strReturn;
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strReturn);
vec.push_back(strReturn);
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed", strReturn);
vec.push_back(strReturn);
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);;
vec.push_back(URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music"));
vec.push_back(URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed"));
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);
}

CStdString CUtil::VideoPlaylistsLocation()
{
vector<CStdString> vec;
CStdString strReturn;
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video", strReturn);
vec.push_back(strReturn);
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed", strReturn);
vec.push_back(strReturn);
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);;
vec.push_back(URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video"));
vec.push_back(URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed"));
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);
}

void CUtil::DeleteMusicDatabaseDirectoryCache()
Expand Down Expand Up @@ -1568,8 +1561,7 @@ CStdString CUtil::GetDefaultFolderThumb(const CStdString &folderThumb)

void CUtil::GetSkinThemes(vector<CStdString>& vecTheme)
{
CStdString strPath;
URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(),"media",strPath);
CStdString strPath = URIUtils::AddFileToFolder(g_graphicsContext.GetMediaDir(), "media");
CFileItemList items;
CDirectory::GetDirectory(strPath, items);
// Search for Themes in the Current skin!
Expand Down
6 changes: 3 additions & 3 deletions xbmc/addons/Addon.cpp
Expand Up @@ -252,7 +252,7 @@ CAddon::CAddon(const cp_extension_t *ext)
{
BuildLibName(ext);
BuildProfilePath();
URIUtils::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_userSettingsPath = URIUtils::AddFileToFolder(Profile(), "settings.xml");
m_enabled = true;
m_hasSettings = true;
m_hasStrings = false;
Expand Down Expand Up @@ -280,7 +280,7 @@ CAddon::CAddon(const AddonProps &props)
if (props.libname.IsEmpty()) BuildLibName();
else m_strLibName = props.libname;
BuildProfilePath();
URIUtils::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_userSettingsPath = URIUtils::AddFileToFolder(Profile(), "settings.xml");
m_enabled = true;
m_hasSettings = true;
m_hasStrings = false;
Expand All @@ -299,7 +299,7 @@ CAddon::CAddon(const CAddon &rhs, const AddonPtr &parent)
m_userSettingsLoaded = rhs.m_userSettingsLoaded;
m_hasSettings = rhs.m_hasSettings;
BuildProfilePath();
URIUtils::AddFileToFolder(Profile(), "settings.xml", m_userSettingsPath);
m_userSettingsPath = URIUtils::AddFileToFolder(Profile(), "settings.xml");
m_strLibName = rhs.m_strLibName;
m_enabled = rhs.Enabled();
m_hasStrings = false;
Expand Down
14 changes: 6 additions & 8 deletions xbmc/addons/AddonCallbacksGUI.cpp
Expand Up @@ -187,10 +187,9 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam
if (!XFILE::CFile::Exists(strSkinPath))
{
/* Check for the matching folder for the skin in the fallback skins folder */
CStdString basePath;
URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources", basePath);
URIUtils::AddFileToFolder(basePath, "skins", basePath);
URIUtils::AddFileToFolder(basePath, URIUtils::GetFileName(g_SkinInfo->Path()), basePath);
CStdString basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources");
basePath = URIUtils::AddFileToFolder(basePath, "skins");
basePath = URIUtils::AddFileToFolder(basePath, URIUtils::GetFileName(g_SkinInfo->Path()));
strSkinPath = g_SkinInfo->GetSkinPath(xmlFilename, &res, basePath);
if (!XFILE::CFile::Exists(strSkinPath))
{
Expand All @@ -206,10 +205,9 @@ GUIHANDLE CAddonCallbacksGUI::Window_New(void *addonData, const char *xmlFilenam
//FIXME make this static method of current skin?
CStdString str("none");
AddonProps props(str, ADDON_SKIN, str, str);
CStdString basePath;
URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources", basePath);
URIUtils::AddFileToFolder(basePath, "skins", basePath);
URIUtils::AddFileToFolder(basePath, defaultSkin, basePath);
CStdString basePath = URIUtils::AddFileToFolder(guiHelper->m_addon->Path(), "resources");
basePath = URIUtils::AddFileToFolder(basePath, "skins");
basePath = URIUtils::AddFileToFolder(basePath, defaultSkin);
props.path = basePath;

CSkinInfo skinInfo(props);
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cdrip/CDDARipper.cpp
Expand Up @@ -193,7 +193,7 @@ bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdS

if (!strAlbumDir.IsEmpty())
{
URIUtils::AddFileToFolder(strDirectory, strAlbumDir, strDirectory);
strDirectory = URIUtils::AddFileToFolder(strDirectory, strAlbumDir);
URIUtils::AddSlashAtEnd(strDirectory);
}

Expand Down
3 changes: 1 addition & 2 deletions xbmc/dbwrappers/sqlitedataset.cpp
Expand Up @@ -211,8 +211,7 @@ int SqliteDatabase::connect(bool create) {

//CLog::Log(LOGDEBUG, "Connecting to sqlite:%s:%s", host.c_str(), db.c_str());

CStdString db_fullpath;
URIUtils::AddFileToFolder(host, db, db_fullpath);
CStdString db_fullpath = URIUtils::AddFileToFolder(host, db);

try
{
Expand Down
6 changes: 2 additions & 4 deletions xbmc/dialogs/GUIDialogFileBrowser.cpp
Expand Up @@ -205,7 +205,6 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message)
{
if (m_browsingForFolders == 2)
{
CStdString strTest;
int iItem = m_viewControl.GetSelectedItem();

CStdString strPath;
Expand All @@ -214,7 +213,7 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message)
else
strPath = (*m_vecItems)[iItem]->GetPath();

URIUtils::AddFileToFolder(strPath,"1",strTest);
CStdString strTest = URIUtils::AddFileToFolder(strPath, "1");
CFile file;
if (file.OpenForWrite(strTest,true))
{
Expand Down Expand Up @@ -252,8 +251,7 @@ bool CGUIDialogFileBrowser::OnMessage(CGUIMessage& message)
CStdString strInput;
if (CGUIKeyboardFactory::ShowAndGetInput(strInput,g_localizeStrings.Get(119),false))
{
CStdString strPath;
URIUtils::AddFileToFolder(m_vecItems->GetPath(),strInput,strPath);
CStdString strPath = URIUtils::AddFileToFolder(m_vecItems->GetPath(), strInput);
if (CDirectory::Create(strPath))
Update(m_vecItems->GetPath());
else
Expand Down
2 changes: 1 addition & 1 deletion xbmc/filesystem/CurlFile.cpp
Expand Up @@ -476,7 +476,7 @@ void CCurlFile::SetCommonOptions(CReadState* state)
// Enable cookie engine for current handle to re-use them in future requests
CStdString strCookieFile;
CStdString strTempPath = CSpecialProtocol::TranslatePath(g_advancedSettings.m_cachePath);
URIUtils::AddFileToFolder(strTempPath, "cookies.dat", strCookieFile);
strCookieFile = URIUtils::AddFileToFolder(strTempPath, "cookies.dat");

g_curlInterface.easy_setopt(h, CURLOPT_COOKIEFILE, strCookieFile.c_str());
g_curlInterface.easy_setopt(h, CURLOPT_COOKIEJAR, strCookieFile.c_str());
Expand Down
4 changes: 2 additions & 2 deletions xbmc/filesystem/RarManager.cpp
Expand Up @@ -136,8 +136,8 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString&
strPath.Replace('/', '\\');
#endif
//g_charsetConverter.unknownToUTF8(strPath);
CStdString strCachedPath;
URIUtils::AddFileToFolder(strDir + "rarfolder%04d", URIUtils::GetFileName(strPathInRar), strCachedPath);
CStdString strCachedPath = URIUtils::AddFileToFolder(strDir + "rarfolder%04d",
URIUtils::GetFileName(strPathInRar));
strCachedPath = CUtil::GetNextPathname(strCachedPath, 9999);
if (strCachedPath.IsEmpty())
{
Expand Down

0 comments on commit a115d4f

Please sign in to comment.