The R Project SVN R

Rev

Rev 32888 | Rev 36901 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32888 Rev 32890
Line 17... Line 17...
17
 *  You should have received a copy of the GNU General Public License
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
20
 */
21
 
21
 
22
#ifdef HAVE_CONFIG_H
-
 
23
#include <config.h>
-
 
24
#endif
-
 
25
#include "win-nls.h"
-
 
26
 
-
 
27
#include <windows.h>
22
#include <windows.h>
28
#include <shlobj.h>
23
#include <shlobj.h>
29
 
24
 
30
int CALLBACK
25
int CALLBACK
31
InitBrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
26
InitBrowseCallbackProc( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
Line 96... Line 91...
96
    * try R_USER then HOME then Windows homes then working directory
91
    * try R_USER then HOME then Windows homes then working directory
97
    */
92
    */
98
    char *p, *q;
93
    char *p, *q;
99
 
94
 
100
    if ((p = getenv("R_USER"))) {
95
    if ((p = getenv("R_USER"))) {
101
	if(strlen(p) >= MAX_PATH) R_Suicide(_("Invalid R_USER"));
96
	if(strlen(p) >= MAX_PATH) R_Suicide("Invalid R_USER");
102
	strcpy(RUser, p);
97
	strcpy(RUser, p);
103
    } else if ((p = getenv("HOME"))) {
98
    } else if ((p = getenv("HOME"))) {
104
	if(strlen(p) >= MAX_PATH) R_Suicide(_("Invalid HOME"));
99
	if(strlen(p) >= MAX_PATH) R_Suicide("Invalid HOME");
105
	strcpy(RUser, p);
100
	strcpy(RUser, p);
106
    } else if (ShellGetPersonalDirectory(RUser)) {
101
    } else if (ShellGetPersonalDirectory(RUser)) {
107
	/* nothing to do */;
102
	/* nothing to do */;
108
    } else if ((p = getenv("HOMEDRIVE")) && (q = getenv("HOMEPATH"))) {
103
    } else if ((p = getenv("HOMEDRIVE")) && (q = getenv("HOMEPATH"))) {
109
	if(strlen(p) >= MAX_PATH) R_Suicide(_("Invalid HOMEDRIVE"));
104
	if(strlen(p) >= MAX_PATH) R_Suicide("Invalid HOMEDRIVE");
110
	strcpy(RUser, p);
105
	strcpy(RUser, p);
111
	if(strlen(RUser) + strlen(q) >= MAX_PATH)
106
	if(strlen(RUser) + strlen(q) >= MAX_PATH)
112
	    R_Suicide(_("Invalid HOMEDRIVE+HOMEPATH"));
107
	    R_Suicide("Invalid HOMEDRIVE+HOMEPATH");
113
	strcat(RUser, q);
108
	strcat(RUser, q);
114
    } else {
109
    } else {
115
	GetCurrentDirectory(MAX_PATH, RUser);
110
	GetCurrentDirectory(MAX_PATH, RUser);
116
    }
111
    }
117
    p = RUser + (strlen(RUser) - 1);
112
    p = RUser + (strlen(RUser) - 1);