VDStringW VDFileSplitExtRight(const VDStringW& s) { return splitimpR(s, VDFileSplitExt(s.c_str())); }
void AppendAVIAutoscan(const wchar_t *pszFile) { wchar_t buf[MAX_PATH]; wchar_t *s = buf, *t; int count = 0; if (!inputAVI) return; IVDStreamSource *pVSS = inputVideo->asStream(); VDPosition originalCount = pVSS->getEnd(); wcscpy(buf, pszFile); t = VDFileSplitExt(VDFileSplitPath(s)); if (t>buf) --t; try { for(;;) { if (!VDDoesPathExist(buf)) break; if (!inputAVI->Append(buf)) break; ++count; s = t; for(;;) { if (s<buf || !isdigit(*s)) { memmove(s+2, s+1, sizeof(wchar_t) * wcslen(s)); s[1] = L'1'; ++t; } else { if (*s == L'9') { *s-- = L'0'; continue; } ++*s; } break; } } } catch(const MyError& e) { // if the first segment failed, turn the warning into an error if (!count) throw; // log append errors, but otherwise eat them VDLog(kVDLogWarning, VDTextAToW(e.gets())); } guiSetStatus("Appended %d segments (stopped at \"%s\")", 255, count, VDTextWToA(buf).c_str()); if (count) { FrameSubset& s = g_project->GetTimeline().GetSubset(); g_project->BeginTimelineUpdate(); s.insert(s.end(), FrameSubsetNode(originalCount, pVSS->getEnd() - originalCount, false, 0)); g_project->EndTimelineUpdate(); } }
VDStringW VDFileSplitExtLeft (const VDStringW& s) { return splitimpL(s, VDFileSplitExt(s.c_str())); }