Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relative paths on Xcode scripts

Tags:

xcode

ios

I'm experimenting running scripts with Xcode and have got a couple of questions:

1) Xcode says to drag n drop the script into the run script section but that creates an absolute path: /Users/Me/Desktop/Project/etc. which is obviously no use if somebody else or a CI machine checks out the code. How to specify a relative path?

2) There's a permission denied error during the build when the script gets executed.

(I'm using scripts off here to experiment with https://gist.github.com/sekati/3172554)

like image 570
Gruntcakes Avatar asked Nov 06 '13 22:11

Gruntcakes


2 Answers

1) Edit your script with the following:

  • Root of the project: ${SRCROOT}
  • Root of the build: ${CONFIGURATION_BUILD_DIR}

2) Press +8, click Build and read the error.

enter image description here

like image 94
Jano Avatar answered Nov 19 '22 23:11

Jano


"$SRCROOT" gives the project folder:

i.e: Users/yourUserName/MyProject

but if you have a workspace folder with multiple projects inside: i.e: Users/yourUserName/MyWorkspace/MyProject

And you need just the workspace folder, use 2 dots:

"../SomeFodler" While someFolder will be created in the workspace folder.

Simple as that.

like image 12
OhadM Avatar answered Nov 19 '22 23:11

OhadM