Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
de1d5ad4
Commit
de1d5ad4
authored
Apr 06, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for WINEPREFIX environment variable.
parent
54fe8380
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
46 deletions
+63
-46
profile.c
files/profile.c
+2
-34
options.h
include/options.h
+0
-1
server.h
include/server.h
+1
-0
client.c
scheduler/client.c
+40
-1
request.c
server/request.c
+20
-10
No files found.
files/profile.c
View file @
de1d5ad4
...
...
@@ -25,7 +25,6 @@
#include "file.h"
#include "heap.h"
#include "debugtools.h"
#include "xmalloc.h"
#include "options.h"
#include "server.h"
...
...
@@ -79,7 +78,6 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
#define WINE_INI_GLOBAL ETCDIR "/wine.conf"
#define WINE_CONFIG_DIR "/.wine"
/* config dir inside $HOME */
static
const
WCHAR
wininiW
[]
=
{
'w'
,
'i'
,
'n'
,
'.'
,
'i'
,
'n'
,
'i'
,
0
};
...
...
@@ -88,36 +86,6 @@ static CRITICAL_SECTION PROFILE_CritSect;
static
const
char
hex
[
16
]
=
"0123456789ABCDEF"
;
/***********************************************************************
* PROFILE_GetConfigDir
*
* Return the name of the configuration directory ($HOME/.wine)
*/
const
char
*
PROFILE_GetConfigDir
(
void
)
{
static
char
*
confdir
;
if
(
!
confdir
)
{
const
char
*
home
=
getenv
(
"HOME"
);
if
(
!
home
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
!
pwd
)
{
fprintf
(
stderr
,
"wine: could not find your home directory
\n
"
);
exit
(
1
);
}
home
=
pwd
->
pw_dir
;
}
confdir
=
xmalloc
(
strlen
(
home
)
+
strlen
(
WINE_CONFIG_DIR
)
+
1
);
strcpy
(
confdir
,
home
);
strcat
(
confdir
,
WINE_CONFIG_DIR
);
mkdir
(
confdir
,
0755
);
/* create it just in case */
}
return
confdir
;
}
/***********************************************************************
* PROFILE_CopyEntry
*
* Copy the content of an entry into a buffer, removing quotes, and possibly
...
...
@@ -501,7 +469,7 @@ static BOOL PROFILE_FlushFile(void)
{
/* Try to create it in $HOME/.wine */
/* FIXME: this will need a more general solution */
strcpy
(
buffer
,
PROFILE_GetConfigD
ir
()
);
strcpy
(
buffer
,
get_config_d
ir
()
);
p
=
buffer
+
strlen
(
buffer
);
*
p
++
=
'/'
;
strcpy
(
p
,
strrchr
(
CurProfile
->
dos_name
,
'\\'
)
+
1
);
...
...
@@ -635,7 +603,7 @@ static BOOL PROFILE_Open( LPCSTR filename )
/* Try to open the profile file, first in $HOME/.wine */
/* FIXME: this will need a more general solution */
strcpy
(
buffer
,
PROFILE_GetConfigD
ir
()
);
strcpy
(
buffer
,
get_config_d
ir
()
);
p
=
buffer
+
strlen
(
buffer
);
*
p
++
=
'/'
;
strcpy
(
p
,
strrchr
(
newdos_name
,
'\\'
)
+
1
);
...
...
include/options.h
View file @
de1d5ad4
...
...
@@ -75,7 +75,6 @@ extern void OPTIONS_ParseOptions( int argc, char *argv[] );
/* Profile functions */
extern
const
char
*
PROFILE_GetConfigDir
(
void
);
extern
int
PROFILE_LoadWineIni
(
void
);
extern
void
PROFILE_UsageWineIni
(
void
);
extern
int
PROFILE_GetWineIniString
(
const
char
*
section
,
const
char
*
key_name
,
...
...
include/server.h
View file @
de1d5ad4
...
...
@@ -1227,6 +1227,7 @@ enum request
extern
unsigned
int
server_call_noerr
(
enum
request
req
);
extern
unsigned
int
server_call_fd
(
enum
request
req
,
int
fd_out
,
int
*
fd_in
);
extern
void
server_protocol_error
(
const
char
*
err
,
...
)
WINE_NORETURN
;
extern
const
char
*
get_config_dir
(
void
);
/* get a pointer to the request buffer */
static
inline
void
*
WINE_UNUSED
get_req_buffer
(
void
)
...
...
scheduler/client.c
View file @
de1d5ad4
...
...
@@ -10,6 +10,7 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
...
...
@@ -36,6 +37,7 @@
#define SCM_RIGHTS 1
#endif
#define CONFDIR "/.wine"
/* directory for Wine config relative to $HOME */
#define SERVERDIR "/wineserver-"
/* server socket directory (hostname appended) */
#define SOCKETNAME "socket"
/* name of the socket file */
...
...
@@ -286,6 +288,43 @@ unsigned int server_call_fd( enum request req, int fd_out, int *fd_in )
/***********************************************************************
* get_config_dir
*
* Return the configuration directory ($WINEPREFIX or $HOME/.wine)
*/
const
char
*
get_config_dir
(
void
)
{
static
char
*
confdir
;
if
(
!
confdir
)
{
const
char
*
prefix
=
getenv
(
"WINEPREFIX"
);
if
(
prefix
)
{
int
len
=
strlen
(
prefix
);
if
(
!
(
confdir
=
strdup
(
prefix
)))
fatal_error
(
"out of memory
\n
"
);
if
(
len
>
1
&&
confdir
[
len
-
1
]
==
'/'
)
confdir
[
len
-
1
]
=
0
;
}
else
{
const
char
*
home
=
getenv
(
"HOME"
);
if
(
!
home
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
!
pwd
)
fatal_error
(
"could not find your home directory
\n
"
);
home
=
pwd
->
pw_dir
;
}
if
(
!
(
confdir
=
malloc
(
strlen
(
home
)
+
strlen
(
CONFDIR
)
+
1
)))
fatal_error
(
"out of memory
\n
"
);
strcpy
(
confdir
,
home
);
strcat
(
confdir
,
CONFDIR
);
}
mkdir
(
confdir
,
0755
);
/* just in case */
}
return
confdir
;
}
/***********************************************************************
* start_server
*
* Start a new wine server.
...
...
@@ -406,7 +445,7 @@ int CLIENT_InitServer(void)
/* get the server directory name */
if
(
gethostname
(
hostname
,
sizeof
(
hostname
)
)
==
-
1
)
fatal_perror
(
"gethostname"
);
configdir
=
PROFILE_GetConfigD
ir
();
configdir
=
get_config_d
ir
();
serverdir
=
malloc
(
strlen
(
configdir
)
+
strlen
(
SERVERDIR
)
+
strlen
(
hostname
)
+
1
);
if
(
!
serverdir
)
fatal_error
(
"out of memory
\n
"
);
strcpy
(
serverdir
,
configdir
);
...
...
server/request.c
View file @
de1d5ad4
...
...
@@ -302,23 +302,33 @@ static void master_socket_destroy( struct object *obj )
socket_cleanup
();
}
/* return the configuration directory ($HOME/.wine) */
/* return the configuration directory ($
WINEPREFIX or $
HOME/.wine) */
static
const
char
*
get_config_dir
(
void
)
{
static
char
*
confdir
;
if
(
!
confdir
)
{
const
char
*
home
=
getenv
(
"HOME
"
);
if
(
!
home
)
const
char
*
prefix
=
getenv
(
"WINEPREFIX
"
);
if
(
prefix
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
!
pwd
)
fatal_error
(
"could not find your home directory
\n
"
);
home
=
pwd
->
pw_dir
;
int
len
=
strlen
(
prefix
);
if
(
!
(
confdir
=
strdup
(
prefix
)))
fatal_error
(
"out of memory
\n
"
);
if
(
len
>
1
&&
confdir
[
len
-
1
]
==
'/'
)
confdir
[
len
-
1
]
=
0
;
}
else
{
const
char
*
home
=
getenv
(
"HOME"
);
if
(
!
home
)
{
struct
passwd
*
pwd
=
getpwuid
(
getuid
()
);
if
(
!
pwd
)
fatal_error
(
"could not find your home directory
\n
"
);
home
=
pwd
->
pw_dir
;
}
if
(
!
(
confdir
=
malloc
(
strlen
(
home
)
+
strlen
(
CONFDIR
)
+
1
)))
fatal_error
(
"out of memory
\n
"
);
strcpy
(
confdir
,
home
);
strcat
(
confdir
,
CONFDIR
);
}
if
(
!
(
confdir
=
malloc
(
strlen
(
home
)
+
strlen
(
CONFDIR
)
+
1
)))
fatal_error
(
"out of memory
\n
"
);
strcpy
(
confdir
,
home
);
strcat
(
confdir
,
CONFDIR
);
mkdir
(
confdir
,
0755
);
/* just in case */
}
return
confdir
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment