]>
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
=
40 static int rb
[] = { IDC_ROOT_TEXT
, IDC_ROOT_BINARY
, 0 };
41 static int su
[] = { IDC_ROOT_SYSTEM
, IDC_ROOT_USER
, 0 };
44 check_if_enable_next (HWND h
)
46 EnableWindow (GetDlgItem (h
, IDOK
), root_text
&& get_root_dir ()
53 rbset (h
, rb
, root_text
);
54 rbset (h
, su
, root_scope
);
55 eset (h
, IDC_ROOT_DIR
, get_root_dir ());
56 check_if_enable_next (h
);
62 root_text
= rbget (h
, rb
);
63 root_scope
= rbget (h
, su
);
64 set_root_dir (eget (h
, IDC_ROOT_DIR
, (char *) get_root_dir ()));
68 browse_cb (HWND h
, UINT msg
, LPARAM lp
, LPARAM data
)
72 case BFFM_INITIALIZED
:
74 SendMessage (h
, BFFM_SETSELECTION
, TRUE
, (LPARAM
) get_root_dir ());
86 memset (&bi
, 0, sizeof (bi
));
88 bi
.pszDisplayName
= name
;
89 bi
.lpszTitle
= "Select an installation root directory";
90 bi
.ulFlags
= BIF_RETURNONLYFSDIRS
;
92 pidl
= SHBrowseForFolder (&bi
);
95 if (SHGetPathFromIDList (pidl
, name
))
96 eset (h
, IDC_ROOT_DIR
, name
);
100 #define isslash(c) ((c) == '\\' || (c) == '/')
103 directory_is_absolute ()
105 const char *r
= get_root_dir ();
106 if (isalpha (r
[0]) && r
[1] == ':' && (r
[2] == '\\' || r
[2] == '/'))
112 directory_is_rootdir ()
115 for (c
= get_root_dir (); *c
; c
++)
116 if (isslash (c
[0]) && c
[1] && !isslash (c
[1]))
122 directory_has_spaces ()
124 if (strchr (get_root_dir (), ' '))
130 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
137 case IDC_ROOT_BINARY
:
138 case IDC_ROOT_SYSTEM
:
141 check_if_enable_next (h
);
144 case IDC_ROOT_BROWSE
:
154 return PropertyPage::Create (NULL
, dialog_cmd
, IDD_ROOT
);
160 if (!get_root_dir ())
162 load_dialog (GetHWND ());
172 if (!directory_is_absolute ())
174 note (h
, IDS_ROOT_ABSOLUTE
);
177 else if (directory_is_rootdir () && (IDNO
== yesno (h
, IDS_ROOT_SLASH
)))
179 else if (directory_has_spaces () && (IDNO
== yesno (h
, IDS_ROOT_SPACE
)))
182 NEXT (IDD_LOCAL_DIR
);
184 log (0, "root: %s %s %s", get_root_dir (),
185 (root_text
== IDC_ROOT_TEXT
) ? "text" : "binary",
186 (root_scope
== IDC_ROOT_USER
) ? "user" : "system");
This page took 0.04891 seconds and 6 git commands to generate.