Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The XR_Actions script file did not support mac terminal #16

Open
hinls1007 opened this issue May 18, 2023 · 2 comments
Open

The XR_Actions script file did not support mac terminal #16

hinls1007 opened this issue May 18, 2023 · 2 comments
Assignees

Comments

@hinls1007
Copy link

Hi all maintainers,

I found that the script SyncContent.ps1 in XR_Actions folder didn't support mac terminal.
Although I installed Powershell in my device, due to the file system, the execution of the script file didn't work well.

According to this behaviour, I wrote a shell script file which can run in Mac Terminal.
Could I know the git follow that I can raise PR for adding the support for Mac users?

@mnefzger
Copy link

mnefzger commented Jun 1, 2023

I'm also interested in a shell script for Mac.
Would you be willing to share a preview here before opening a PR, @hinls1007? Would be much appreciated.

@hinls1007
Copy link
Author

Hi @mnefzger

Here is the shell script for the mac user (that may compatible with linux, but I didn't perform any test).
Please advice if this script have anythings can enhance or fix

#!/bin/bash

gcs_bucket=$1
if [ -z $gcs_bucket ]; then
	echo "Please input Bucket name"
	exit 1
fi

ProjectPath=$(dirname "$0")
cd $ProjectPath/..
ProjectPath=$(pwd)
ProjectFile=$(find *.uproject | head -1); echo $A;

SyncFiles=("$ProjectFile" "CHANGELOG.md")

FoldersList=("Content" "Config" "Cloud" "ToBuild" "Source" "Plugins" "ToCustomize")
SyncFolders=()
for folder in ${FoldersList[@]}
do
	if [ -d "$ProjectPath/$folder" ]; then
		SyncFolders+=($folder)
	fi
done


echo "Sync the following files and folders to gs://$gcs_bucket:"
printf -v SyncFileString '%s, ' "${SyncFiles[@]}"
echo "Files: ${SyncFileString:0:${#SyncFileString}-2}"
printf -v SyncFolderString '%s, ' "${SyncFolders[@]}"
echo "Folders: ${SyncFolderString:0:${#SyncFolderString}-2}"

read -r -p "Proceed? (Y/n) " response
case "$response" in
    [yY][eE][sS]|[yY]) 
        break
        ;;
    *)
        exit 1
        ;;
esac

echo "Deleting all *.uproject files..."
gsutil rm gs://${gcs_bucket}/*.uproject


for file in ${SyncFiles[@]}
do
	echo "Copying file ""$SyncFile""..."
  	gsutil cp "$ProjectPath/$file" gs://$gcs_bucket/$file
done

for folder in ${SyncFolders[@]}
do
	echo "Synching folder ""$folder""..."
	gsutil -m rsync -r -d "$ProjectPath/$folder" gs://$gcs_bucket/$folder
done

echo "All files uploaded."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants