bool readPlayList() { scoped_ptr<SharedMemory> shm(monapi_file_read_directory(APPLICATION_DATA_DIR)); if (NULL == shm.get()) return false; int size = *(int*)shm->data(); if (size == 0) return false; monapi_directoryinfo* p = (monapi_directoryinfo*)shm->data()[sizeof(int)]; for (int i = 0; i < size; i++, p++) { string file = p->name; if (StringHelper::endsWith(file, ".MML")) { playList_.push_back(file); } } return playList_.size() != 0; }
bool readPlayList() { monapi_cmemoryinfo* mi = monapi_file_read_directory(APPLICATION_DATA_DIR); if (NULL == mi) return false; int size = *(int*)mi->Data; if (size == 0) return false; monapi_directoryinfo* p = (monapi_directoryinfo*)&mi->Data[sizeof(int)]; for (int i = 0; i < size; i++, p++) { string file = p->name; if (StringHelper::endsWith(file, ".MML")) { playList_.push_back(file); } } monapi_cmemoryinfo_dispose(mi); monapi_cmemoryinfo_delete(mi); return playList_.size() != 0; }