File: deprecated.lib

package info (click to toggle)
playonlinux 4.3.4-5
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 8,252 kB
  • sloc: sh: 5,390; python: 5,150; ansic: 72; makefile: 57; xml: 47
file content (443 lines) | stat: -rwxr-xr-x 14,952 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#!/bin/bash

# Copyright (C) 2007-2011 PlayOnLinux Team
# Copyright (C) 2007-2011 Pâris Quentin

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# deprecated.lib
# --------------
#
# This lib contains PlayOnLinux's v3 old functions, so that the scripts can stay compatible
# Please do NOT use these functions anymore !


#############################
##### Old GUI functions #####
#############################

POL_SetupWindow_message_image ()
{
	# Show a message with an image
	# Now, it calls POL_SetupWindow_message
	
	POL_Debug_Warning "Deprecated function!"
	POL_SetupWindow_message "$@"
}

POL_SetupWindow_detect_exit ()
{
	# Detect if "Cancel" button has been clicked in a Setup Window. 
	# If it's the case, the function kills the scripts
	# In version 4, python automatically kills bash process, so this function has became useless
	# Usage: POL_SetupWindow_detect_exit
	
	POL_Debug_Warning "POL_SetupWindow_detect_exit is deprecated"
	MESSAGE_BIS=$(cat "$POL_USER_ROOT/configurations/guis/$POL_SetupWindow_ID" | grep '^MSG_RECEIVED=')
	if [ "$MESSAGE_BIS" = "MSG_RECEIVED=Cancel" ]
	then
		rm "$POL_USER_ROOT/configurations/guis/$POL_SetupWindow_ID"
		exit 
	fi
}
POL_SetupWindow_games ()
{
	# Show the list of programs installed.
	# This function has been renamed to POL_SetupWindow_shorcuts_list
	# Usage: POL_SetupWindow_shortucts_list
	
	POL_Debug_Warning "Deprecated function"
	POL_SetupWindow_shortcuts_list "$@"
}

POL_SetupWindow_install_wine ()
{
	# This function installs a version of wine into playonlinux environment
	# It has been renamed to POL_Wine_InstallVersion
	# Usage: POL_SetupWindow_install_wine [VERSION]
	
	POL_Debug_Warning "Function deprecated"
	POL_Wine_InstallVersion "$@"
}

#########################################
##### Old prefix creation functions #####
#########################################

POL_SetupWindow_specialprefixcreate ()
{
	# Create a prefix for very old version of wine
	# It also rename program files directory and users directory to english names
	# Can cause problems
	# Usage: POL_SetupWindow_specialprefixcreate
	
	POL_Debug_Warning "Very deprecated ! Use POL_Wine_PrefixCreate"
	POL_SetupWindow_wait_next_signal "$(eval_gettext 'Please wait while the virtual drive is being created...')" "$TITLE"
	wine wineprefixcreate
	sleep 2
	set_user_dir
	set_programfile_dir
	POL_SetupWindow_detect_exit
}
POL_SetupWindow_oldprefixcreate ()
{
	# Create a prefix for very old version of wine
	# Usage: POL_SetupWindow_oldprefixcreate
	
	POL_Debug_Warning "Very deprecated ! Use POL_Wine_PrefixCreate"
	POL_SetupWindow_wait_next_signal "$(eval_gettext 'Please wait while the virtual drive is being created...')" "$TITLE"
	wine wineprefixcreate
	POL_SetupWindow_detect_exit
}
POL_SetupWindow_prefixcreate ()
{
	# Create a prefix (virtual drive)
	# Renamed to POL_Wine_PrefixCreate
	# Usage: POL_SetupWindow_prefixcreate
	
	POL_Debug_Warning "Very deprecated ! Use POL_Wine_PrefixCreate"
	POL_Wine_PrefixCreate "$@"
}
POL_SetupWindow_normalprefixcreate()
{
	# Just create a prefix, without setting any version of wine and without detecting architecture
	# May not work as expected
	# Usage: POL_SetupWindow_normalprefixcreate
	
	POL_Debug_Warning "Very deprecated ! Use POL_Wine_PrefixCreate"
	sleep 1
	POL_SetupWindow_wait_next_signal "$(eval_gettext 'Please wait while the virtual drive is being created...')" "$TITLE"
	wine wineboot
}

select_prefixe ()
{
	# Select a wineprefix
	# Usage: select_prefixe "/path/to/prefix"
	
	POL_Debug_Warning "Deprecated function ! Use POL_Wine_SelectPrefix"
	export WINEPREFIX="$1"
	export DOSPREFIX="$1" # For dosbox support
}
select_prefix ()
{
	# Copy of select_prefixe
	# Usage: select_prefix "/path/to/prefix"
	select_prefixe "$@"
}

##############################
##### Old Wine functions #####
##############################

Set_GLSL ()
{
	# Enable or disable GLSL support in the selected prefix
	# This function is regrouped with others. Therefore, you should replace it by "POL_Wine_Direct3D UseGLSL"
	# Usage: Set_GLSL (On|Off)
	POL_Debug_Warning "Set_GLSL depracted, please use POL_Wine_Direct3D UseGLSL"
	# On ou Off
	if [ "$1" = "On" ] || [ "$1" == "enabled" ]
	then
		echo "[HKEY_CURRENT_USER\Software\Wine\Direct3D]" > "$POL_USER_ROOT/tmp/glsl.reg"
		echo "\"UseGLSL\"=\"enabled\"" >> "$POL_USER_ROOT/tmp/glsl.reg"
		wine regedit "$POL_USER_ROOT/tmp/glsl.reg"
		rm -f "$POL_USER_ROOT/tmp/glsl.reg"
	fi
	if [ "$1" = "Off" ] || [ "$1" == "disabled" ]
	then
		echo "[HKEY_CURRENT_USER\Software\Wine\Direct3D]" > "$POL_USER_ROOT/tmp/glsl.reg"
		echo "\"UseGLSL\"=\"disabled\"" >> "$POL_USER_ROOT/tmp/glsl.reg"
		wine regedit "$POL_USER_ROOT/tmp/glsl.reg"
		rm -f "$POL_USER_ROOT/tmp/glsl.reg"
	fi
}
installer_wine_version ()
{
	# Copy of POL_SetupWindow_install_wine
	# Usage: POL_SetupWindow_install_wine [VERSION]
	POL_SetupWindow_install_wine "$@"
}
Set_WineVersion_Assign ()
{
	# Set a version of wine for a shortcut
	# In POL 4, wine versions are no longer assigned to a shortcut, 
	# but they are assigned to a prefix. 
	# This function detects the prefix of the shortcut in the first argument to assign the good version
	
	# Usage: Set_WineVersion_Assign [VERSION] [SHORTCUT]
	
	local prefixold="$WINEPREFIX"
	POL_Debug_Warning "Function deprecated !"
	export WINEPREFIX="$POL_USER_ROOT/wineprefix/$(POL_Shortcut_GetPrefix "$2")"
	POL_Wine_SetVersionPrefix "$1"
	export WINEPREFIX="$prefixold"
}


fonts_to_prefixe ()
{
	# Install microsoft fonts to a prefix
	# Replaced by POL_Wine_InstallFonts
	# Usage: fonts_to_prefixe
	POL_Wine_InstallFonts "$@"
}
fonts_to_prefix ()
{
	# Install microsoft fonts to a prefix
	# Replaced by POL_Wine_InstallFonts
	# Usage: fonts_to_prefix
	POL_Wine_InstallFonts "$@"
}
Use_WineVersion()
{
	# Set the good wineversion in PATH
	# No longer needed, use POL_WINEVERSION variable before calling POL_Wine
	# Usage: Use_WineVersion [VERSION]
	POL_Debug_Warning "Function is deprecated. Use export WINEVERSION instead"
	export POL_WINEVERSION="$1"
}




##########################################
##### Old shorcut creation functions #####
##########################################

POL_SetupWindow_make_shortcut()
{
	# Make a shortcut into PlayOnLinux
	# Use POL_Shortcut
	# Usage: POL_SetupWindow_make_shortcut [Prefix name] [Program's directory] [Program's file] [POL Website icon] [Name of the sortcut] [Leave empty] [Argument]
	
	POL_Debug_Warning "Deprecated function! Use POL_Shortcut"
	local PREFIX="$(POL_Wine_GetPrefixFromPath "$WINEPREFIX")"
	if [ "$1" = "$PREFIX" ]; then
	    POL_Shortcut "$2/$3" "$4" "$5" "$7"
	else
	    # Are there real use cases?
	    POL_Debug_Warning "Temporarily set prefix to $1 as requested"
	    POL_Wine_SelectPrefix "$1"
	    POL_Shortcut "$2/$3" "$4" "$5" "$7"
	    POL_Wine_SelectPrefix "$PREFIX"
	fi
}

POL_SetupWindow_auto_shortcut()
{
	# Make a shortcut into PlayOnLinux, easier using than POL_SetupWindow_make_shortcut
	# Use POL_Shortcut
	# Usage: POL_SetupWindow_auto_shortcut [Prefix name] [Program's binary file] [Name of the shortcut] [POL Website icon] [Argument]
	
	POL_Debug_Warning "Deprecated function! Use POL_Shortcut"
	local PREFIX="$(POL_Wine_GetPrefixFromPath "$WINEPREFIX")"
	if [ "$1" = "$PREFIX" ]; then
	    POL_Shortcut "$2" "$3" "$4" "$5"
	else
	    # Are there real use cases?
	    POL_Debug_Warning "Temporarily set prefix to $1 as requested"
	    POL_Wine_SelectPrefix "$1"
	    POL_Shortcut "$2" "$3" "$4" "$5"
	    POL_Wine_SelectPrefix "$PREFIX"
	fi
}
POL_SetupWindow_shortcut()
{
	# Copy of POL_Shortcut
	# Usage: POL_SetupWindow_shortcut [Program's binary file] [Name] [Icon] [Argument]

	POL_Debug_Warning "POL_SetupWindow_shortcut is deprecated"
	POL_Shortcut "$@"
}

POL_SetupError()
{
	# Old error function. Replaced by debugging API
	# Usage: command | POL_SetupError [Messagge]
	
	POL_Debug_Warning "Deprecated function"
	POL_SetupWindow_message "$1\n\nAborting." "Error"
	POL_SetupWindow_Close
	exit
}



POL_SetupWindow_get_local_icon ()
{
	# Get a local icon (.local folder) and assign it to a shortcut
	POL_Debug_Warning "Deprecated function" 
	POL_GetLocalIcon "$@"
}

generer_icone() {
	make_desktop_shortcut "$@"
}

POL_SetupWindow_reboot ()
{
	# Simulate windows reboot
	# Usage: POL_SetupWindow_reboot
	POL_SetupWindow_wait_next_signal "$(eval_gettext 'Please wait while $APPLICATION_TITLE is simulating a Windows reboot')" "Wine"
	wine wineboot
	POL_SetupWindow_detect_exit
}


read_prefixes()
{
	# Get the list of prefixes
	cd "$POL_USER_ROOT/wineprefix"
	LIST_FILE=""
	for file in *
	do	
		if [ "$LIST_FILE" = "" ]
		then
			LIST_FILE="$file" 
		else
			LIST_FILE+="~$file"
		fi
	done
	echo $LIST_FILE
}

set_user_dir()
{
	# Change directory name's to english one
cat << EOF > /tmp/pol_user.reg
REGEDIT4

[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer]

[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced]

[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders]
"AppData"="C:\\\\windows\\\\profiles\\\\$USER\\\\Application Data"
"Cache"="C:\\\\windows\\\\profiles\\\\$USER\\\\Local Settings\\\\Temporary Internet Files"
"Cookies"="C:\\\\windows\\\\profiles\\\\$USER\\\\Cookies"
"Desktop"="C:\\\\windows\\\\profiles\\\\$USER\\\\Desktop"
"Favorites"="C:\\\\windows\\\\profiles\\\\$USER\\\\Favorites"
"Fonts"="C:\\\\windows\\\\Fonts"
"History"="C:\\\\windows\\\\profiles\\\\$USER\\\\Local Settings\\\\History"
"Local AppData"="C:\\\\windows\\\\profiles\\\\$USER\\\\Local Settings\\\\Application Data"
"My Music"="C:\\\\windows\\\\profiles\\\\$USER\\\\My Music"
"My Pictures"="C:\\\\windows\\\\profiles\\\\$USER\\\\My Pictures"
"My Videos"="C:\\\\windows\\\\profiles\\\\$USER\\\\My Videos"
"NetHood"="C:\\\\windows\\\\profiles\\\\$USER\\\\Network Hood"
"Personal"="C:\\\\windows\\\\profiles\\\\$USER\\\\My documents"
"PrintHood"="C:\\\\windows\\\\profiles\\\\$USER\\\\Printing Hood"
"Programs"="C:\\\\windows\\\\profiles\\\\$USER\\\\Start Menu\\\\Programs"
"Recent"="C:\\\\windows\\\\profiles\\\\$USER\\\\Recent"
"SendTo"="C:\\\\windows\\\\profiles\\\\$USER\\\\SendTo"
"Start Menu"="C:\\\\windows\\\\profiles\\\\$USER\\\\Start Menu"
"StartUp"="C:\\\\windows\\\\profiles\\\\$USER\\\\Start Menu\\\\Programs\\\\StartUp"
"Templates"="C:\\\\windows\\\\profiles\\\\$USER\\\\Templates"

[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders]
"AppData"="%USERPROFILE%\\\\Application Data"
"Cache"="%USERPROFILE%\\\\Local Settings\\\\Temporary Internet Files"
"Cookies"="%USERPROFILE%\\\\Cookies"
"Desktop"="%USERPROFILE%\\\\Desktop"
"Favorites"="%USERPROFILE%\\\\Favorites"
"Fonts"="C:\\\\windows\\\\Fonts"
"History"="%USERPROFILE%\\\\Local Settings\\\\Historique"
"Local AppData"="%USERPROFILE%\\\\Local Settings\\\\Application Data"
"My Music"="%USERPROFILE%\\\\My Music"
"My Pictures"="%USERPROFILE%\\\\My Pictures"
"My Videos"="%USERPROFILE%\\\\My Videos"
"NetHood"="%USERPROFILE%\\\\Network Hood"
"Personal"="%USERPROFILE%\\\\My Documents"
"PrintHood"="%USERPROFILE%\\\\Printing hood"
"Programs"="%USERPROFILE%\\\\Start Menu\\\\Programs"
"Recent"="%USERPROFILE%\\\\Recent"
"SendTo"="%USERPROFILE%\\\\SendTo"
"Start Menu"="%USERPROFILE%\\\\Start Menu"
"StartUp"="%USERPROFILE%\\\\Start Menu\\\\Programs\\\\StartUp"
"Templates"="%USERPROFILE%\\\\Templates"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer]

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop]

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace]

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\{450D8FBA-AD25-11D0-98A8-0800361B1103}]
@="My Documents"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\{645FF040-5081-101B-9F08-00AA002F954E}]
@="Trash"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\{9D20AAE8-0625-44B0-9CA7-71889C2254D9}]
@="/"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer]

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\Namespace]

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MyComputer\\Namespace\\{21EC2020-3AEA-1069-A2DD-08002B30309D}]
@="Control Panel"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders]
"Common AppData"="C:\\\\windows\\\\profiles\\\\All Users\\\\Application Data"
"Common Desktop"="C:\\\\windows\\\\profiles\\\\All Users\\\\Desktop"
"Common Documents"="C:\\\\windows\\\\profiles\\\\All Users\\\\Documents"
"Common Programs"="C:\\\\windows\\\\profiles\\\\All Users\\\\Start Menu\\\\Programs"
"Common Start Menu"="C:\\\\windows\\\\profiles\\\\All Users\\\\Start Menu"
"Common StartUp"="C:\\\\windows\\\\profiles\\\\All Users\\\\Start Menu\\\\Programs\\\\StartUp"
"Common Templates"="C:\\\\windows\\\\profiles\\\\All Users\\\\Templates"
"Favorites"="C:\\\\windows\\\\profiles\\\\All Users\\\\Favorites"

[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders]
"Common AppData"="%ALLUSERSPROFILE%\\\\Application Data"
"Common Desktop"="%ALLUSERSPROFILE%\\\\Desktop"
"Common Documents"="%ALLUSERSPROFILE%\\\\Documents"
"Common Programs"="%ALLUSERSPROFILE%\\\\Start Menu\\\\Programs"
"Common Start Menu"="%ALLUSERSPROFILE%\\\\Start Menu"
"Common StartUp"="%ALLUSERSPROFILE%\\\\Start Menu\\\\Programs\\\\StartUp"
"Common Templates"="%ALLUSERSPROFILE%\\\\Templates"
"Favorites"="%ALLUSERSPROFILE%\\\\Favorites"
EOF
wine regedit /tmp/pol_user.reg
}

set_programfile_dir()
{
	# Change directory's name to english one (program file)
	#made by cendre, edited by tinou
	#email:cendrev3v3@gmail.com
	if [ ! "$WINEPREFIX" ]
	then
		export WINEPREFIX="$HOME/.wine"
	fi
	REG="$POL_USER_ROOT/tmp/reg.reg"
	echo "$(eval_gettext "Setting Program Files var")"
	rm -f "$REG"
	cat <<EOF > "$REG"
[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion]
"ProgramFilesDir"="C:\\\\Program Files"
EOF
	wine regedit "$REG"
	rm -f "$REG"
	wine wineprefixcreate
	#fi
	
	#rm -rf $REG
}

find_binary() {
	# find_binary was a private function in the first place
	POL_System_find_file "$@"
}