]>
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. */
21 static const char *cvsid
=
39 static int rb
[] = { IDC_ROOT_TEXT
, IDC_ROOT_BINARY
, 0 };
40 static int su
[] = { IDC_ROOT_SYSTEM
, IDC_ROOT_USER
, 0 };
43 check_if_enable_next (HWND h
)
45 EnableWindow (GetDlgItem (h
, IDOK
), root_text
&& get_root_dir ().size()
52 rbset (h
, rb
, root_text
);
53 rbset (h
, su
, root_scope
);
54 eset (h
, IDC_ROOT_DIR
, get_root_dir ());
55 check_if_enable_next (h
);
61 root_text
= rbget (h
, rb
);
62 root_scope
= rbget (h
, su
);
63 set_root_dir (egetString (h
, IDC_ROOT_DIR
));
67 browse_cb (HWND h
, UINT msg
, LPARAM lp
, LPARAM data
)
71 case BFFM_INITIALIZED
:
72 if (get_root_dir ().size())
73 SendMessage (h
, BFFM_SETSELECTION
, TRUE
, (LPARAM
) get_root_dir ().cstr_oneuse());
85 memset (&bi
, 0, sizeof (bi
));
87 bi
.pszDisplayName
= name
;
88 bi
.lpszTitle
= "Select an installation root directory";
89 bi
.ulFlags
= BIF_RETURNONLYFSDIRS
;
91 pidl
= SHBrowseForFolder (&bi
);
94 if (SHGetPathFromIDList (pidl
, name
))
95 eset (h
, IDC_ROOT_DIR
, name
);
99 #define isslash(c) ((c) == '\\' || (c) == '/')
102 directory_is_absolute ()
105 const char *r
= get_root_dir ().cstr();
106 if (isalpha (r
[0]) && r
[1] == ':' && (r
[2] == '\\' || r
[2] == '/'))
116 directory_is_rootdir ()
118 char *t
=get_root_dir ().cstr();
121 if (isslash (c
[0]) && c
[1] && !isslash (c
[1]))
129 directory_has_spaces ()
131 if (get_root_dir ().find(' '))
137 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
144 case IDC_ROOT_BINARY
:
145 case IDC_ROOT_SYSTEM
:
148 check_if_enable_next (h
);
151 case IDC_ROOT_BROWSE
:
161 return PropertyPage::Create (NULL
, dialog_cmd
, IDD_ROOT
);
167 if (!get_root_dir ().size())
169 load_dialog (GetHWND ());
179 if (!directory_is_absolute ())
181 note (h
, IDS_ROOT_ABSOLUTE
);
184 else if (directory_is_rootdir () && (IDNO
== yesno (h
, IDS_ROOT_SLASH
)))
186 else if (directory_has_spaces () && (IDNO
== yesno (h
, IDS_ROOT_SPACE
)))
189 NEXT (IDD_LOCAL_DIR
);
191 log (LOG_PLAIN
, String ("root: ") + get_root_dir () +
192 (root_text
== IDC_ROOT_TEXT
? " text" : " binary") +
193 (root_scope
== IDC_ROOT_USER
? " user" : " system"));
This page took 1.497656 seconds and 5 git commands to generate.