Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
switch CFileItem::m_strPath to private, and add GetPath/SetPath for a…
Browse files Browse the repository at this point in the history
…ccess
  • Loading branch information
Jonathan Marshall committed Aug 8, 2011
1 parent fc785d4 commit 6d27f0f
Show file tree
Hide file tree
Showing 149 changed files with 1,311 additions and 1,275 deletions.
62 changes: 31 additions & 31 deletions xbmc/Application.cpp
Expand Up @@ -527,7 +527,7 @@ bool CApplication::Create()
CFileItemList items;
CUtil::GetRecursiveListing("special://xbmc/userdata",items,"");
for (int i=0;i<items.Size();++i)
CFile::Cache(items[i]->m_strPath,"special://masterprofile/"+URIUtils::GetFileName(items[i]->m_strPath));
CFile::Cache(items[i]->GetPath(),"special://masterprofile/"+URIUtils::GetFileName(items[i]->GetPath()));
}
g_settings.m_logFolder = "special://masterprofile/";
}
Expand Down Expand Up @@ -1738,13 +1738,13 @@ bool CApplication::LoadUserWindows()
{
if (items[i]->m_bIsFolder)
continue;
CStdString skinFile = URIUtils::GetFileName(items[i]->m_strPath);
CStdString skinFile = URIUtils::GetFileName(items[i]->GetPath());
if (skinFile.Left(6).CompareNoCase("custom") == 0)
{
TiXmlDocument xmlDoc;
if (!xmlDoc.LoadFile(items[i]->m_strPath))
if (!xmlDoc.LoadFile(items[i]->GetPath()))
{
CLog::Log(LOGERROR, "unable to load:%s, Line %d\n%s", items[i]->m_strPath.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
CLog::Log(LOGERROR, "unable to load:%s, Line %d\n%s", items[i]->GetPath().c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
continue;
}

Expand Down Expand Up @@ -2334,7 +2334,7 @@ bool CApplication::OnAction(const CAction &action)
CMusicDatabase db;
if (db.Open()) // OpenForWrite() ?
{
db.SetSongRating(m_itemCurrentFile->m_strPath, m_itemCurrentFile->GetMusicInfoTag()->GetRating());
db.SetSongRating(m_itemCurrentFile->GetPath(), m_itemCurrentFile->GetMusicInfoTag()->GetRating());
db.Close();
}
// send a message to all windows to tell them to update the fileitem (eg playlistplayer, media windows)
Expand Down Expand Up @@ -3303,11 +3303,11 @@ bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)
{
CDirectory dir;
CFileItemList items;
if (dir.GetDirectory(item.m_strPath, items) && items.Size())
if (dir.GetDirectory(item.GetPath(), items) && items.Size())
{
CSmartPlaylist smartpl;
//get name and type of smartplaylist, this will always succeed as GetDirectory also did this.
smartpl.OpenAndReadName(item.m_strPath);
smartpl.OpenAndReadName(item.GetPath());
CPlayList playlist;
playlist.Add(items);
return ProcessAndStartPlaylist(smartpl.GetName(), playlist, (smartpl.GetType() == "songs" || smartpl.GetType() == "albums") ? PLAYLIST_MUSIC:PLAYLIST_VIDEO);
Expand All @@ -3319,7 +3319,7 @@ bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)

//is or could be a playlist
auto_ptr<CPlayList> pPlayList (CPlayListFactory::Create(item));
bool gotPlayList = (pPlayList.get() && pPlayList->Load(item.m_strPath));
bool gotPlayList = (pPlayList.get() && pPlayList->Load(item.GetPath()));

if (dlgCache)
{
Expand All @@ -3332,10 +3332,10 @@ bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)
{

if (iPlaylist != PLAYLIST_NONE)
return ProcessAndStartPlaylist(item.m_strPath, *pPlayList, iPlaylist);
return ProcessAndStartPlaylist(item.GetPath(), *pPlayList, iPlaylist);
else
{
CLog::Log(LOGWARNING, "CApplication::PlayMedia called to play a playlist %s but no idea which playlist to use, playing first item", item.m_strPath.c_str());
CLog::Log(LOGWARNING, "CApplication::PlayMedia called to play a playlist %s but no idea which playlist to use, playing first item", item.GetPath().c_str());
if(pPlayList->size())
return PlayFile(*(*pPlayList)[0], false);
}
Expand Down Expand Up @@ -3368,15 +3368,15 @@ bool CApplication::PlayStack(const CFileItem& item, bool bRestart)
CVideoDatabase dbs;
if (dbs.Open())
{
dbs.GetVideoSettings(item.m_strPath, g_settings.m_currentVideoSettings);
haveTimes = dbs.GetStackTimes(item.m_strPath, times);
dbs.GetVideoSettings(item.GetPath(), g_settings.m_currentVideoSettings);
haveTimes = dbs.GetStackTimes(item.GetPath(), times);
dbs.Close();
}


// calculate the total time of the stack
CStackDirectory dir;
dir.GetDirectory(item.m_strPath, *m_currentStack);
dir.GetDirectory(item.GetPath(), *m_currentStack);
long totalTime = 0;
for (int i = 0; i < m_currentStack->Size(); i++)
{
Expand All @@ -3385,7 +3385,7 @@ bool CApplication::PlayStack(const CFileItem& item, bool bRestart)
else
{
int duration;
if (!CDVDFileInfo::GetFileDuration((*m_currentStack)[i]->m_strPath, duration))
if (!CDVDFileInfo::GetFileDuration((*m_currentStack)[i]->GetPath(), duration))
{
m_currentStack->Clear();
return false;
Expand All @@ -3403,13 +3403,13 @@ bool CApplication::PlayStack(const CFileItem& item, bool bRestart)
if (dbs.Open())
{
if( !haveTimes )
dbs.SetStackTimes(item.m_strPath, times);
dbs.SetStackTimes(item.GetPath(), times);

if( item.m_lStartOffset == STARTOFFSET_RESUME )
{
// can only resume seek here, not dvdstate
CBookmark bookmark;
if( dbs.GetResumeBookMark(item.m_strPath, bookmark) )
if( dbs.GetResumeBookMark(item.GetPath(), bookmark) )
seconds = bookmark.timeInSeconds;
else
seconds = 0.0f;
Expand Down Expand Up @@ -3478,15 +3478,15 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
if (item.IsPlugin())
{ // we modify the item so that it becomes a real URL
CFileItem item_new(item);
if (XFILE::CPluginDirectory::GetPluginResult(item.m_strPath, item_new))
if (XFILE::CPluginDirectory::GetPluginResult(item.GetPath(), item_new))
return PlayFile(item_new, false);
return false;
}

if (URIUtils::IsUPnP(item.m_strPath))
if (URIUtils::IsUPnP(item.GetPath()))
{
CFileItem item_new(item);
if (XFILE::CUPnPDirectory::GetResource(item.m_strPath, item_new))
if (XFILE::CUPnPDirectory::GetResource(item.GetPath(), item_new))
return PlayFile(item_new, false);
return false;
}
Expand All @@ -3500,7 +3500,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
//Is TuxBox, this should probably be moved to CFileTuxBox
if(item.IsTuxBox())
{
CLog::Log(LOGDEBUG, "%s - TuxBox URL Detected %s",__FUNCTION__, item.m_strPath.c_str());
CLog::Log(LOGDEBUG, "%s - TuxBox URL Detected %s",__FUNCTION__, item.GetPath().c_str());

if(g_tuxboxService.IsRunning())
g_tuxboxService.Stop();
Expand Down Expand Up @@ -3550,13 +3550,13 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
// open the d/b and retrieve the bookmarks for the current movie
CVideoDatabase dbs;
dbs.Open();
dbs.GetVideoSettings(item.m_strPath, g_settings.m_currentVideoSettings);
dbs.GetVideoSettings(item.GetPath(), g_settings.m_currentVideoSettings);

if( item.m_lStartOffset == STARTOFFSET_RESUME )
{
options.starttime = 0.0f;
CBookmark bookmark;
CStdString path = item.m_strPath;
CStdString path = item.GetPath();
if (item.IsDVD())
path = item.GetVideoInfoTag()->m_strFileNameAndPath;
if(dbs.GetResumeBookMark(path, bookmark))
Expand Down Expand Up @@ -3656,7 +3656,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
}
else
{
CLog::Log(LOGERROR, "Error creating player for item %s (File doesn't exist?)", item.m_strPath.c_str());
CLog::Log(LOGERROR, "Error creating player for item %s (File doesn't exist?)", item.GetPath().c_str());
bResult = false;
}

Expand Down Expand Up @@ -3986,7 +3986,7 @@ void CApplication::SaveFileState()
void CApplication::UpdateFileState()
{
// Did the file change?
if (m_progressTrackingItem->m_strPath != "" && m_progressTrackingItem->m_strPath != CurrentFile())
if (m_progressTrackingItem->GetPath() != "" && m_progressTrackingItem->GetPath() != CurrentFile())
{
SaveFileState();

Expand All @@ -3997,7 +3997,7 @@ void CApplication::UpdateFileState()
{
if (IsPlayingVideo() || IsPlayingAudio())
{
if (m_progressTrackingItem->m_strPath == "")
if (m_progressTrackingItem->GetPath() == "")
{
// Init some stuff
*m_progressTrackingItem = CurrentFileItem();
Expand Down Expand Up @@ -4389,14 +4389,14 @@ bool CApplication::OnMessage(CGUIMessage& message)
{
if (!m_itemCurrentFile->HasMusicInfoTag() || !m_itemCurrentFile->GetMusicInfoTag()->Loaded())
{
IMusicInfoTagLoader* tagloader = CMusicInfoTagLoaderFactory::CreateLoader(m_itemCurrentFile->m_strPath);
tagloader->Load(m_itemCurrentFile->m_strPath,*m_itemCurrentFile->GetMusicInfoTag());
IMusicInfoTagLoader* tagloader = CMusicInfoTagLoaderFactory::CreateLoader(m_itemCurrentFile->GetPath());
tagloader->Load(m_itemCurrentFile->GetPath(),*m_itemCurrentFile->GetMusicInfoTag());
delete tagloader;
}
m_pKaraokeMgr->Start(m_itemCurrentFile->GetMusicInfoTag()->GetURL());
}
else
m_pKaraokeMgr->Start(m_itemCurrentFile->m_strPath);
m_pKaraokeMgr->Start(m_itemCurrentFile->GetPath());
}
#endif
// Let scrobbler know about the track
Expand Down Expand Up @@ -4563,7 +4563,7 @@ bool CApplication::ExecuteXBMCAction(std::string actionStr)
#ifdef HAS_PYTHON
if (item.IsPythonScript())
{ // a python script
g_pythonParser.evalFile(item.m_strPath.c_str(),ADDON::AddonPtr());
g_pythonParser.evalFile(item.GetPath().c_str(),ADDON::AddonPtr());
}
else
#endif
Expand Down Expand Up @@ -4836,7 +4836,7 @@ void CApplication::Restart(bool bSamePosition)

const CStdString& CApplication::CurrentFile()
{
return m_itemCurrentFile->m_strPath;
return m_itemCurrentFile->GetPath();
}

CFileItem& CApplication::CurrentFileItem()
Expand Down Expand Up @@ -5259,7 +5259,7 @@ void CApplication::SaveCurrentFileSettings()
{
CVideoDatabase dbs;
dbs.Open();
dbs.SetVideoSettings(m_itemCurrentFile->m_strPath, g_settings.m_currentVideoSettings);
dbs.SetVideoSettings(m_itemCurrentFile->GetPath(), g_settings.m_currentVideoSettings);
dbs.Close();
}
}
Expand Down
6 changes: 2 additions & 4 deletions xbmc/ApplicationMessenger.cpp
Expand Up @@ -364,7 +364,7 @@ case TMSG_POWERDOWN:
{
pSlideShow->Add(items[i].get());
}
pSlideShow->Select(items[0]->m_strPath);
pSlideShow->Select(items[0]->GetPath());
}
}
else
Expand Down Expand Up @@ -798,9 +798,7 @@ void CApplicationMessenger::ExecBuiltIn(const CStdString &command, bool wait)

void CApplicationMessenger::MediaPlay(string filename)
{
CFileItem item;
item.m_strPath = filename;
item.m_bIsFolder = false;
CFileItem item(filename, false);
if (item.IsAudio())
item.SetMusicThumb();
else
Expand Down
22 changes: 11 additions & 11 deletions xbmc/Autorun.cpp
Expand Up @@ -172,10 +172,10 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
CFileItemPtr pItem = vecItems[i];

// is the current item a (non system) folder?
if (pItem->m_bIsFolder && pItem->m_strPath != "." && pItem->m_strPath != "..")
if (pItem->m_bIsFolder && pItem->GetPath() != "." && pItem->GetPath() != "..")
{
// Check if the current foldername indicates a DVD structure (name is "VIDEO_TS")
if (pItem->m_strPath.Find( "VIDEO_TS" ) != -1 && bAllowVideo
if (pItem->GetPath().Find( "VIDEO_TS" ) != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
CUtil::PlayDVD("dvd", restart);
Expand All @@ -186,7 +186,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
// Check if the current foldername indicates a Blu-Ray structure (default is "BDMV").
// A BR should also include an "AACS" folder for encryption, Sony-BRs can also include update folders for PS3 (PS3_UPDATE / PS3_VPRM).
// ToDo: for the time beeing, the DVD autorun settings are used to determine if the BR should be started automatically.
if (pItem->m_strPath.Find( "BDMV" ) != -1 && bAllowVideo
if (pItem->GetPath().Find( "BDMV" ) != -1 && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
CUtil::PlayDVD("bd", restart);
Expand All @@ -196,17 +196,17 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded

// Video CDs can have multiple file formats. First we need to determine which one is used on the CD
CStdString strExt;
if (pItem->m_strPath.Find("MPEGAV") != -1)
if (pItem->GetPath().Find("MPEGAV") != -1)
strExt = ".dat";
if (pItem->m_strPath.Find("MPEG2") != -1)
if (pItem->GetPath().Find("MPEG2") != -1)
strExt = ".mpg";

// If a file format was extracted we are sure this is a VCD. Autoplay if settings indicate we should.
if (!strExt.IsEmpty() && bAllowVideo
&& (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
CFileItemList items;
CDirectory::GetDirectory(pItem->m_strPath, items, strExt);
CDirectory::GetDirectory(pItem->GetPath(), items, strExt);
if (items.Size())
{
items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC);
Expand All @@ -219,12 +219,12 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
}
}
/* Probably want this if/when we add some automedia action dialog...
else if (pItem->m_strPath.Find("PICTURES") != -1 && bAllowPictures
else if (pItem->GetPath().Find("PICTURES") != -1 && bAllowPictures
&& (bypassSettings))
{
bPlaying = true;
CStdString strExec;
strExec.Format("XBMC.RecursiveSlideShow(%s)", pItem->m_strPath.c_str());
strExec.Format("XBMC.RecursiveSlideShow(%s)", pItem->GetPath().c_str());
CBuiltins::Execute(strExec);
return true;
}
Expand Down Expand Up @@ -254,7 +254,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
// TODO: remove this once the app/player is capable of handling stacks immediately
CStackDirectory dir;
CFileItemList items;
dir.GetDirectory(pItem->m_strPath, items);
dir.GetDirectory(pItem->GetPath(), items);
itemlist.Append(items);
}
else
Expand Down Expand Up @@ -318,9 +318,9 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
CFileItemPtr pItem = vecItems[i];
if (pItem->m_bIsFolder)
{
if (pItem->m_strPath != "." && pItem->m_strPath != ".." )
if (pItem->GetPath() != "." && pItem->GetPath() != ".." )
{
if (RunDisc(pDir, pItem->m_strPath, nAddedToPlaylist, false, bypassSettings, restart))
if (RunDisc(pDir, pItem->GetPath(), nAddedToPlaylist, false, bypassSettings, restart))
{
bPlaying = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/BackgroundInfoLoader.cpp
Expand Up @@ -91,7 +91,7 @@ void CBackgroundInfoLoader::Run()
}
catch (...)
{
CLog::Log(LOGERROR, "%s::LoadItem - Unhandled exception for item %s", __FUNCTION__, pItem->m_strPath.c_str());
CLog::Log(LOGERROR, "%s::LoadItem - Unhandled exception for item %s", __FUNCTION__, pItem->GetPath().c_str());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions xbmc/CueDocument.cpp
Expand Up @@ -376,9 +376,9 @@ bool CCueDocument::ResolvePath(CStdString &strPath, const CStdString &strBase)
CDirectory::GetDirectory(strDirectory,items);
for (int i=0;i<items.Size();++i)
{
if (items[i]->m_strPath.Equals(strPath))
if (items[i]->GetPath().Equals(strPath))
{
strPath = items[i]->m_strPath;
strPath = items[i]->GetPath();
return true;
}
}
Expand Down

0 comments on commit 6d27f0f

Please sign in to comment.