Adding a check to make the staging isn't trying to copy from itself

I would like to submit this pull request to fix an instance where the system will try to copy files into itself(${D} directory) if the ${STAGING_DIR_TARGET} variable is empty.