Hello,
I'm totally new to scripting but I got sick and tired of compiling my native code for Android manually so I wrote a little .sh script and a .bat file to run this script in cygwin. Both files are placed in the root of a project, in the .sh file the NDK directory is set and then by running the .bat file I compile my native code.
The problem is that I want to do it dynamically so I use %CD% to get the current directory ( which should be the project folder) and start the .sh file in that directory.
Here are both files:
.bat :
@echo off
::Used to surpess a warning about dos directory format.
set CYGWIN=nodosfilewarning
C:\cygwin\bin\bash --login -i %CD%\./compile.sh
pause
.sh:
#!/bin/bash
#Run this script through compileNative.bat This will compile the native code of this Project
#IF this file is changed under windows use "tr -d '\r' < edited.sh > final.sh " to remove the bad line endings.
#Keep both this and the .bat file in the project root.
# Set this to the base NDKDir
NDKDIR=C:/Android/NDK/
#Get the base dir so we can change the directory to the base dir.
BASEDIR=`dirname $0`
echo
echo Compiling Native code. Refresh Workspace after this is done!
echo
#Change to the directory of the project, change this is if the project movies.
cd $BASEDIR
#Run the ndk build file. Change this to the correct location.
$NDKDIR./ndk-build
When I open the .bat file from the folder in windows it runs just fine. When I run it from eclipse though it seems that %CD% gives me "C:/Eclipse". What annoys me more is the fact that it ran all morning, but that suddenly it started doing this.
So my question is, am I using %CD% in the wrong way or why can this happen. Obviously this is not a big drama. But it is a little annoying problem I can't seem to figure out.
Some Help would be great.