]>
cygwin.com Git - cygwin-apps/setup.git/blob - root.cc
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 DJ Delorie <dj@cygnus.com>
16 /* The purpose of this file is to ask the user where they want the
17 root of the installation to be, and to ask whether the user prefers
18 text or binary mounts. */
32 static int rb
[] = { IDC_ROOT_TEXT
, IDC_ROOT_BINARY
, 0 };
35 check_if_enable_next (HWND h
)
37 EnableWindow (GetDlgItem (h
, IDOK
), root_text
&& root_dir
);
43 rbset (h
, rb
, root_text
);
44 eset (h
, IDC_ROOT_DIR
, root_dir
);
45 check_if_enable_next (h
);
51 root_text
= rbget (h
, rb
);
52 root_dir
= eget (h
, IDC_ROOT_DIR
, root_dir
);
59 root_dir
= find_root_mount (&istext
);
63 root_text
= IDC_ROOT_TEXT
;
65 root_text
= IDC_ROOT_BINARY
;
70 browse_cb (HWND h
, UINT msg
, LPARAM lp
, LPARAM data
)
74 case BFFM_INITIALIZED
:
75 SendMessage (h
, BFFM_SETSELECTION
, TRUE
, (LPARAM
)root_dir
);
87 memset (&bi
, 0, sizeof (bi
));
89 bi
.pszDisplayName
= name
;
90 bi
.lpszTitle
= "Select an installation root directory";
91 bi
.ulFlags
= BIF_RETURNONLYFSDIRS
;
93 pidl
= SHBrowseForFolder (&bi
);
96 if (SHGetPathFromIDList (pidl
, name
))
97 eset (h
, IDC_ROOT_DIR
, name
);
101 #define isslash(c) ((c) == '\\' || (c) == '/')
104 directory_is_absolute ()
106 if (isalpha (root_dir
[0])
107 && root_dir
[1] == ':'
108 && (root_dir
[2] == '\\' || root_dir
[2] == '/'))
114 directory_is_rootdir ()
117 for (c
= root_dir
; *c
; c
++)
118 if (isslash(c
[0]) && c
[1] && !isslash(c
[1]))
124 directory_has_spaces ()
126 if (strchr (root_dir
, ' '))
132 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
139 case IDC_ROOT_BINARY
:
141 check_if_enable_next (h
);
144 case IDC_ROOT_BROWSE
:
151 if (! directory_is_absolute ())
153 note (IDS_ROOT_ABSOLUTE
);
157 if (directory_is_rootdir ())
158 if (IDNO
== yesno (IDS_ROOT_SLASH
))
161 if (directory_has_spaces ())
162 if (IDNO
== yesno (IDS_ROOT_SPACE
))
167 case IDC_SOURCE_NETINST
:
171 NEXT(IDD_S_FROM_CWD
);
174 msg("source is default? %d\n", source
);
191 dialog_proc (HWND h
, UINT message
, WPARAM wParam
, LPARAM lParam
)
199 return HANDLE_WM_COMMAND(h
, wParam
, lParam
, dialog_cmd
);
205 do_root (HINSTANCE h
)
210 rv
= DialogBox (h
, MAKEINTRESOURCE (IDD_ROOT
), 0, dialog_proc
);
212 fatal (IDS_DIALOG_FAILED
);
This page took 0.04617 seconds and 6 git commands to generate.