Index: src/simutrans/dataobj/pakset_downloader.cc
===================================================================
--- src/simutrans/dataobj/pakset_downloader.cc	(revisión: 10696)
+++ src/simutrans/dataobj/pakset_downloader.cc	(copia de trabajo)
@@ -99,15 +99,15 @@
 		ls.set_info(ps->name);
 #ifdef _WIN32
 		param.append("powershell -ExecutionPolicy ByPass -NoExit ");
-		param.append(env_t::base_dir);
+		param.append(env_t::install_dir);
 		param.append("get_pak.ps1 \"" );
 #else
 #ifndef __ANDROID__
-		param.append( env_t::base_dir);
+		param.append( env_t::install_dir);
 		param.append("get_pak.sh \"");
 #else
 		param.append("sh ");
-		param.append(env_t::base_dir);
+		param.append(env_t::install_dir);
 		param.append("get_pak.sh \"");
 #endif
 #endif
Index: src/simutrans/sys/simsys.cc
===================================================================
--- src/simutrans/sys/simsys.cc	(revisión: 10696)
+++ src/simutrans/sys/simsys.cc	(copia de trabajo)
@@ -446,19 +446,19 @@
 	strcat(buffer, PATH_SEPARATOR);
 	strcat(buffer, foldername);
 #elif defined __APPLE__
-	sprintf(buffer, "%s/Library/Simutrans/simutrans", getenv("HOME"));
+	sprintf(buffer, "%s/Library/Simutrans/paksets", getenv("HOME"));
 #elif defined __HAIKU__
 	BPath userDir;
 	find_directory(B_USER_DIRECTORY, &userDir);
-	sprintf(buffer, "%s/simutrans", userDir.Path());
+	sprintf(buffer, "%s/simutrans/paksets", userDir.Path());
 #elif defined __ANDROID__
 	tstrncpy(buffer,SDL_GetPrefPath("Simutrans Team","simutrans"),lengthof(buffer));
 #else
 	if( getenv("XDG_DATA_HOME") == NULL ) {
-		sprintf(buffer, "%s/simutrans/simutrans", getenv("HOME"));
+		sprintf(buffer, "%s/simutrans/paksets", getenv("HOME"));
 	}
 	else {
-		sprintf(buffer, "%s/simutrans/simutrans", getenv("XDG_DATA_HOME"));
+		sprintf(buffer, "%s/simutrans/paksets", getenv("XDG_DATA_HOME"));
 	}
 #endif
 
Index: tools/get_pak.sh
===================================================================
--- tools/get_pak.sh	(revisión: 10696)
+++ tools/get_pak.sh	(copia de trabajo)
@@ -7,7 +7,7 @@
 
 #
 # script to fetch pak sets
-# Downloads pak sets and installs them into $(pwd)/
+# Downloads pak sets and installs them into $(pwd)/ or install_dir
 #
 
 # make sure that non-existing variables are not ignored
@@ -97,9 +97,9 @@
 	files=$(echo "$files"|grep "^simutrans/")
 	if [ $? -eq 0 ]; then
 		# has simutrans folder
-		destdir="$(pwd)"
+		destdir="$TEMP"
 	else
-		destdir="$(pwd)/simutrans"
+		destdir="$TEMP/simutrans"
 	fi
 
 	tar -zxf "$pakzippath" -C "$destdir" || {
@@ -119,9 +119,9 @@
 	files=$(unzip -Z1 "$pakzippath" | grep "^simutrans/")
 	if [ $? -eq 0 ]; then
 		# we have simutrans already
-		destdir="$(pwd)"
+		destdir="$TEMP"
 	else
-		destdir="$(pwd)/simutrans"
+		destdir="$TEMP/simutrans"
 	fi
 
 	echo "Extracting '$pakzippath' to '$destdir'..."
@@ -172,6 +172,16 @@
 		return 1
 	fi
 
+	# Install the files downloaded on the tmp directory
+	mv "$TEMP/simutrans/"* "$install_dir"
+	result=$?
+	rm -rf "$TEMP/simutrans"
+	if [ $result -ne 0 ]; then
+		echo "Error: Cannot move files to the install directory" >&2
+		echo "Installation failed." >&2
+		return 1
+	fi
+
 	echo "Installation completed."
 	return 0
 }
@@ -324,10 +334,22 @@
 	exit 0
 fi
 
-pwd | grep "/simutrans$" >/dev/null || {
-	echo "Cannot install paksets: Must be in a simutrans/ directory" >&2
+# Check if the given directory is writeable
+if [ -w $(pwd) ]; then
+	install_dir="$(pwd)"
+# Linux fallback 1
+elif [ -d "$HOME/simutrans/paksets" ]; then
+	install_dir="$HOME/simutrans/paksets"
+# Linux fallback 2
+elif [ -d "$XDG_HOME/simutrans/paksets" ]; then
+	install_dir="$XDG_HOME/simutrans/paksets"
+# macOS fallback
+elif [ -d "$HOME/Library/Simutrans/paksets" ]; then
+	install_dir="$HOME/Library/Simutrans/paksets"
+else
+	echo "Cannot install paksets: Must be in a writeable directory" >&2
 	exit 1
-}
+fi
 
 # first find out, if we have a command options and just install these paks
 # parameter is the full path to the pakset
@@ -424,7 +446,7 @@
 			let "setcount += 1"
 		done
 
-		echo "into directory '$(pwd)'"
+		echo "into directory '$install_dir'"
 		read -p "Is this correct? (y/n)" yn
 		if [[ $yn = [yY] ]]; then
 			break
