def find_blade_root_dir(working_dir):
 blade_root_dir = working_dir
 if blade_root_dir.endswith('/'):
  blade_root_dir = blade_root_dir[:(-1)]
 while (blade_root_dir and (blade_root_dir != '/')):
  if os.path.isfile(os.path.join(blade_root_dir, 'BLADE_ROOT')):
   break
  blade_root_dir = os.path.dirname(blade_root_dir)
 if ((not blade_root_dir) or (blade_root_dir == '/')):
  console.error_exit("Can't find the file 'BLADE_ROOT' in this or any upper directory.\nBlade need this file as a placeholder to locate the root source directory (aka the directory where you #include start from).\nYou should create it manually at the first time.")
 return blade_root_dir

def find_blade_root_dir ( working_dir ) : blade_root_dir = working_dir if blade_root_dir . endswith ( '/' ) : blade_root_dir = blade_root_dir [ : ( - 1 ) ] while ( blade_root_dir and ( blade_root_dir != '/' ) ) : if os . path . isfile ( os . path . join ( blade_root_dir , 'BLADE_ROOT' ) ) : break blade_root_dir = os . path . dirname ( blade_root_dir ) if ( ( not blade_root_dir ) or ( blade_root_dir == '/' ) ) : console . error_exit ( "Can't find the file 'BLADE_ROOT' in this or any upper directory.\nBlade need this file as a placeholder to locate the root source directory (aka the directory where you #include start from).\nYou should create it manually at the first time." ) return blade_root_dir
find_blade_root_dir to find the dir holds the blade_root file .