-
Notifications
You must be signed in to change notification settings - Fork 1
/
MissingFilesDlg.cpp
102 lines (84 loc) · 2.26 KB
/
MissingFilesDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyleft 2004 Chris Korda
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or any later version.
/*
chris korda
revision history:
rev date comments
00 21nov03 initial version
01 16jan04 add file filter argument to ctor
02 01oct04 use IDC_ prefix for all controls
missing files dialog
*/
// MissingFilesDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Resource.h"
#include "MissingFilesDlg.h"
#include "ReplaceFilesDlg.h"
#include "Shlwapi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMissingFilesDlg dialog
CMissingFilesDlg::CMissingFilesDlg(CStringArray& Path, LPCSTR Filter, CWnd* pParent /*=NULL*/)
: m_Path(Path), m_Filter(Filter), CDialog(CMissingFilesDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMissingFilesDlg)
//}}AFX_DATA_INIT
}
void CMissingFilesDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMissingFilesDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMissingFilesDlg, CDialog)
//{{AFX_MSG_MAP(CMissingFilesDlg)
ON_BN_CLICKED(IDC_PROCEED, OnProceed)
ON_BN_CLICKED(IDC_OPENDLG, OnOpendlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMissingFilesDlg message handlers
void CMissingFilesDlg::OnProceed()
{
EndDialog(IDIGNORE);
}
void CMissingFilesDlg::OnOpendlg()
{
EndDialog(IDC_OPENDLG);
}
int CMissingFilesDlg::Check()
{
bool MissingFiles = FALSE;
int retc = IDOK;
for (int i = 0; i < m_Path.GetSize(); i++) {
if (m_Path[i].GetLength() && !PathFileExists(m_Path[i]))
MissingFiles = TRUE;
}
if (MissingFiles) {
{
CReplaceFilesDlg rfd(m_Path, m_Filter);
switch (retc = DoModal()) {
case IDC_OPENDLG:
retc = rfd.DoModal();
break;
case IDOK:
if (!rfd.Search())
retc = rfd.DoModal();
break;
}
}
// delete any remaining missing files
for (int i = 0; i < m_Path.GetSize(); i++) {
if (m_Path[i] && !PathFileExists(m_Path[i]))
m_Path[i].Empty();
}
}
return(retc);
}