2 * Copyright (c) 2000, Red Hat, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
13 * based on work and suggestions of DJ Delorie
15 * Sync'ed with cinstall 2001-10-16
18 /* The purpose of this file is to ask the user where they want the
19 root of the installation to be, and to ask whether the user prefers
20 text or binary mounts. */
38 check_if_enable_next (HWND h)
40 EnableWindow (GetDlgItem (h, IDOK), local_dir != 0);
46 eset (h, IDC_LOCAL_DIR, local_dir);
47 check_if_enable_next (h);
53 local_dir = eget (h, IDC_LOCAL_DIR, local_dir);
58 browse_cb (HWND h, UINT m, LPARAM lp, LPARAM data)
62 case BFFM_INITIALIZED:
64 SendMessage (h, BFFM_SETSELECTION, TRUE, (LPARAM)local_dir);
76 memset (&bi, 0, sizeof (bi));
78 bi.pszDisplayName = name;
79 bi.lpszTitle = "Select download directory";
80 bi.ulFlags = BIF_RETURNONLYFSDIRS;
82 pidl = SHBrowseForFolder (&bi);
85 if (SHGetPathFromIDList (pidl, name))
86 eset (h, IDC_LOCAL_DIR, name);
92 dialog_cmd (HWND h, int id, HWND hwndctl, UINT code)
99 check_if_enable_next (h);
102 case IDC_LOCAL_DIR_BROWSE:
108 if (_access (local_dir, 0) != 0 && yesno (IDS_CREATE_DIR, local_dir) == IDYES)
110 log (0, "Created install directory %s\n", local_dir);
111 mkdir_p (1, local_dir);
113 if (SetCurrentDirectoryA (local_dir))
117 case IDC_SOURCE_DOWNLOAD:
120 case IDC_SOURCE_NETINST:
130 note (IDS_ERR_CHDIR, local_dir);
146 dialog_proc (HWND h, UINT message, WPARAM wParam, LPARAM lParam)
154 return HANDLE_WM_COMMAND (h, wParam, lParam, dialog_cmd);
159 extern char cwd[_MAX_PATH];
162 do_local_dir (HINSTANCE h)
165 rv = DialogBox (h, MAKEINTRESOURCE (IDD_LOCAL_DIR), 0, dialog_proc);
167 fatal (IDS_DIALOG_FAILED);
169 log (0, "Selected local directory: %s", local_dir);