]>
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. */
33 static int rb
[] = { IDC_ROOT_TEXT
, IDC_ROOT_BINARY
, 0 };
34 static int su
[] = { IDC_ROOT_SYSTEM
, IDC_ROOT_USER
, 0 };
37 check_if_enable_next (HWND h
)
39 EnableWindow (GetDlgItem (h
, IDOK
), root_text
&& root_dir
&& root_scope
);
45 rbset (h
, rb
, root_text
);
46 rbset (h
, su
, root_scope
);
47 eset (h
, IDC_ROOT_DIR
, root_dir
);
48 check_if_enable_next (h
);
54 root_text
= rbget (h
, rb
);
55 root_scope
= rbget (h
, su
);
56 root_dir
= eget (h
, IDC_ROOT_DIR
, root_dir
);
64 root_dir
= find_root_mount (&istext
, &issystem
);
68 root_text
= IDC_ROOT_TEXT
;
70 root_text
= IDC_ROOT_BINARY
;
72 root_scope
= IDC_ROOT_SYSTEM
;
74 root_scope
= IDC_ROOT_USER
;
78 char windir
[_MAX_PATH
];
79 GetWindowsDirectory (windir
, sizeof (windir
));
81 root_dir
= concat (windir
, "\\cygwin", 0);
82 root_text
= IDC_ROOT_BINARY
;
83 root_scope
= IDC_ROOT_USER
;
88 browse_cb (HWND h
, UINT msg
, LPARAM lp
, LPARAM data
)
92 case BFFM_INITIALIZED
:
94 SendMessage (h
, BFFM_SETSELECTION
, TRUE
, (LPARAM
)root_dir
);
106 memset (&bi
, 0, sizeof (bi
));
108 bi
.pszDisplayName
= name
;
109 bi
.lpszTitle
= "Select an installation root directory";
110 bi
.ulFlags
= BIF_RETURNONLYFSDIRS
;
112 pidl
= SHBrowseForFolder (&bi
);
115 if (SHGetPathFromIDList (pidl
, name
))
116 eset (h
, IDC_ROOT_DIR
, name
);
120 #define isslash(c) ((c) == '\\' || (c) == '/')
123 directory_is_absolute ()
125 if (isalpha (root_dir
[0])
126 && root_dir
[1] == ':'
127 && (root_dir
[2] == '\\' || root_dir
[2] == '/'))
133 directory_is_rootdir ()
136 for (c
= root_dir
; *c
; c
++)
137 if (isslash(c
[0]) && c
[1] && !isslash(c
[1]))
143 directory_has_spaces ()
145 if (strchr (root_dir
, ' '))
151 dialog_cmd (HWND h
, int id
, HWND hwndctl
, UINT code
)
158 case IDC_ROOT_BINARY
:
159 case IDC_ROOT_SYSTEM
:
162 check_if_enable_next (h
);
165 case IDC_ROOT_BROWSE
:
172 if (! directory_is_absolute ())
174 note (IDS_ROOT_ABSOLUTE
);
178 if (directory_is_rootdir ())
179 if (IDNO
== yesno (IDS_ROOT_SLASH
))
182 if (directory_has_spaces ())
183 if (IDNO
== yesno (IDS_ROOT_SPACE
))
188 case IDC_SOURCE_NETINST
:
192 NEXT(IDD_S_FROM_CWD
);
195 msg("source is default? %d\n", source
);
212 dialog_proc (HWND h
, UINT message
, WPARAM wParam
, LPARAM lParam
)
220 return HANDLE_WM_COMMAND(h
, wParam
, lParam
, dialog_cmd
);
226 do_root (HINSTANCE h
)
231 rv
= DialogBox (h
, MAKEINTRESOURCE (IDD_ROOT
), 0, dialog_proc
);
233 fatal (IDS_DIALOG_FAILED
);
This page took 0.045987 seconds and 6 git commands to generate.