2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
15 #include <afs/param.h>
19 #include "afs_shl_ext.h"
20 #include "make_symbolic_link_dlg.h"
27 static char THIS_FILE
[] = __FILE__
;
30 /////////////////////////////////////////////////////////////////////////////
31 // CMakeMountPointDlg dialog
34 CMakeSymbolicLinkDlg::CMakeSymbolicLinkDlg(CWnd
* pParent
/*=NULL*/)
37 InitModalIndirect (TaLocale_GetDialogResource (CMakeSymbolicLinkDlg::IDD
), pParent
);
39 //{{AFX_DATA_INIT(CMakeSymbolicLinkDlg)
46 void CMakeSymbolicLinkDlg::DoDataExchange(CDataExchange
* pDX
)
48 CDialog::DoDataExchange(pDX
);
49 //{{AFX_DATA_MAP(CMakeSymbolicLinkDlg)
50 DDX_Control(pDX
, IDOK
, m_OK
);
51 DDX_Control(pDX
, IDC_NAME
, m_Name
);
52 DDX_Control(pDX
, IDC_DIR
, m_Dir
);
53 DDX_Text(pDX
, IDC_NAME
, m_strName
);
54 DDV_MaxChars(pDX
, m_strName
, 63);
55 DDX_Text(pDX
, IDC_DIR
, m_strDir
);
56 DDV_MaxChars(pDX
, m_strDir
, 255);
61 BEGIN_MESSAGE_MAP(CMakeSymbolicLinkDlg
, CDialog
)
62 //{{AFX_MSG_MAP(CMakeSymbolicLinkDlg)
66 /////////////////////////////////////////////////////////////////////////////
67 // CMakeSymbolicLinkDlg message handlers
69 void CMakeSymbolicLinkDlg::OnOK()
75 m_Name
.GetWindowText(strName
);
76 m_Dir
.GetWindowText(strTarget
);
77 if (!IsPathInAfs(m_sBase
)) {
78 MessageBeep((UINT
)-1);
79 strTarget
+=" - Path is not in AFS directory";
80 AfxMessageBox(strTarget
,MB_ICONERROR
);
83 if (m_sBase
.GetLength()>MAX_PATH
-2)
85 MessageBeep((UINT
)-1);
86 ShowMessageBox(IDS_CURRENT_DIRECTORY_PATH_TOO_LONG
,MB_ICONERROR
,IDS_CURRENT_DIRECTORY_PATH_TOO_LONG
);
88 if (!SetCurrentDirectory(m_sBase
))
90 MessageBeep((UINT
)-1);
91 ShowMessageBox(IDS_UNABLE_TO_SET_CURRENT_DIRECTORY
,MB_ICONERROR
,IDS_UNABLE_TO_SET_CURRENT_DIRECTORY
);
94 if ((code
=MakeSymbolicLink(strName
,strTarget
))!=0){
95 MessageBeep((UINT
)-1);
96 ShowMessageBox(IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK
,MB_ICONERROR
,IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK
,GetAfsError(code
, strName
));
102 void CMakeSymbolicLinkDlg::OnChangeName()
105 m_Name.GetWindowText(strName);
106 if (strName.GetLength() > 63) {
107 MessageBeep((UINT)-1);
108 m_Name.SetWindowText(m_strName);
114 void CMakeSymbolicLinkDlg::OnChangeDir()
116 m_Dir.GetWindowText(m_strDir);
117 if (!IsPathInAfs(m_strDir)) {
118 MessageBeep((UINT)-1);
119 m_Dir.SetWindowText(m_strDir);
124 void CMakeSymbolicLinkDlg::CheckEnableOk()
126 BOOL bEnable
= FALSE
;
128 if ((m_strName
.GetLength() > 0) && (m_strDir
.GetLength() > 0))
131 m_OK
.EnableWindow(bEnable
);
134 BOOL
CMakeSymbolicLinkDlg::OnInitDialog()
136 CDialog::OnInitDialog();
138 // m_Dir.SetWindowText(m_strDir);
139 // m_Name.SetWindowText(m_strName);
142 return TRUE
; // return TRUE unless you set the focus to a control
143 // EXCEPTION: OCX Property Pages should return FALSE