Sophie
April 20th, 1999, 01:03 PM
Hi,
What I'm trying to accomplish is to add "Lavac\Lecons" to my m_questPath before I start any copying.
So basically the user will type a path where they want to copy. For example :
C:\temp and from there I add Lavac\Lecons and copy all folders and files underneath Lecons. Right now the code will create the C:\temp\Lavac\Lecons but will copy L0000001 underneath C:\temp.
Can someone help me?
CString CDlgQuestionPath::GetQuesPath()
{
return m_quesPath;
}
void CDlgQuestionPath::OnChangeQuesPath()
{
UpdateData(TRUE); //Will update all existing variables.
CString quesPath = GetQuesPath();
Path path(ToString(quesPath));
path.AppendToPath("Lavac\\Lecons");
}
void CDlgQuestionPath::OnQuesBrowse()
{
CString quesPath = GetQuesPath();
CString strTitle;
strTitle.LoadString(IDS_TITLE);
CSelectFolder dlg(quesPath,strTitle, this) ;
if(dlg.DoModal() == IDOK)
{
m_quesPath = dlg.GetFolder();
UpdateData(FALSE);
}
}
void CDlgQuestionPath::OnOK()
{
bool canExit = true;
UpdateData(TRUE); //Will update all existing variables.
CString destPath = GetQuesPath();
Path path(ToString(destPath));
if (!path.IsDirect()){
int iResponse = AfxMessageBox(IDS_WARN_NODIRECTORYEXIST, MB_YESNO|MB_ICONQUESTION);
if(iResponse == IDYES) {
Directory dir(ToString(destPath));
dir.AppendToPath("Lavac\\Lecons");
if(dir.Create() == false){
AfxMessageBox(IDS_WARN_DIRCREATIONFAILED, MB_OK|MB_ICONWARNING);
canExit = false;
}
}
else{
canExit = false;
}
}
else{
path.AppendToPath("Lavac\\Lecons");
}
if(canExit == true)
CDialog::OnOK();
}
Path &Path::AppendToPath( const string &base)
{
if( name.length() == 0)
SetPath( base);
else{
AddPathSeparator();
if( base[ 0] == PathSep)
name.append( base, 1, base.length() - 1);
else
name.append( base, 0, base.length());
name= FullPath( name);
}
return *this;
}
What I'm trying to accomplish is to add "Lavac\Lecons" to my m_questPath before I start any copying.
So basically the user will type a path where they want to copy. For example :
C:\temp and from there I add Lavac\Lecons and copy all folders and files underneath Lecons. Right now the code will create the C:\temp\Lavac\Lecons but will copy L0000001 underneath C:\temp.
Can someone help me?
CString CDlgQuestionPath::GetQuesPath()
{
return m_quesPath;
}
void CDlgQuestionPath::OnChangeQuesPath()
{
UpdateData(TRUE); //Will update all existing variables.
CString quesPath = GetQuesPath();
Path path(ToString(quesPath));
path.AppendToPath("Lavac\\Lecons");
}
void CDlgQuestionPath::OnQuesBrowse()
{
CString quesPath = GetQuesPath();
CString strTitle;
strTitle.LoadString(IDS_TITLE);
CSelectFolder dlg(quesPath,strTitle, this) ;
if(dlg.DoModal() == IDOK)
{
m_quesPath = dlg.GetFolder();
UpdateData(FALSE);
}
}
void CDlgQuestionPath::OnOK()
{
bool canExit = true;
UpdateData(TRUE); //Will update all existing variables.
CString destPath = GetQuesPath();
Path path(ToString(destPath));
if (!path.IsDirect()){
int iResponse = AfxMessageBox(IDS_WARN_NODIRECTORYEXIST, MB_YESNO|MB_ICONQUESTION);
if(iResponse == IDYES) {
Directory dir(ToString(destPath));
dir.AppendToPath("Lavac\\Lecons");
if(dir.Create() == false){
AfxMessageBox(IDS_WARN_DIRCREATIONFAILED, MB_OK|MB_ICONWARNING);
canExit = false;
}
}
else{
canExit = false;
}
}
else{
path.AppendToPath("Lavac\\Lecons");
}
if(canExit == true)
CDialog::OnOK();
}
Path &Path::AppendToPath( const string &base)
{
if( name.length() == 0)
SetPath( base);
else{
AddPathSeparator();
if( base[ 0] == PathSep)
name.append( base, 1, base.length() - 1);
else
name.append( base, 0, base.length());
name= FullPath( name);
}
return *this;
}