def get_output_folders(self, platform, configuration, tgen=None, target_name=None): output_paths = [] class dummy_tgen: def __getattr__(self, attribute): return None tsk_gen = tgen or dummy_tgen() # if target is provided, see if it's in the override list, if it is then override with specific logic target = target_name or tsk_gen.name if target and target in lmbr_override_target_map: output_paths = [self.get_lmbr_setup_tools_output_folder(platform, configuration)] # if no overwrite provided if len(output_paths) == 0: # check if output_folder is defined output_paths = getattr(tsk_gen, 'output_folder', None) if output_paths: if not isinstance(output_paths, list): output_paths = [output_paths] # otherwise use default path generation rule else: output_paths = [self.get_output_target_folder(platform, configuration)] output_nodes = [] for path in output_paths: # Ensure output casing matches project configuration to prevent case-sensitive WAF methods from evicting nodes parent_path,dir_name = os.path.split(os.path.abspath(path)) if os.path.exists(path) and dir_name not in os.listdir(parent_path): try: os.rename(path, path) except: warning = '[WARN] Unable to modify output path (possibly due to an output file being open). ' \ 'This warning can be ignored if displayed output path casing matches what is on disk: {0}'.format(path) Logs.warn_once(warning) # Correct handling for absolute paths if os.path.isabs(path): output_nodes.append(self.root.make_node(path)) else: host = Utils.unversioned_sys_platform() if host == 'win32': host = 'win' is_host_target = (platform in self.get_platform_aliases(host)) # for host targets, the binaries will be split between the engine and project directory if is_host_target: if not self.is_engine_local() and getattr(tsk_gen, 'project_local', False): root_node = self.get_launch_node() else: root_node = self.get_engine_node() # while all other target's binaries will be exclusively output into the project directory else: root_node = self.get_launch_node() output_nodes.append(root_node.make_node(path)) return output_nodes
def get_output_folders(self, platform, configuration, ctx=None, target=None): output_paths = [] # if target is provided, see if it's in the override list, if it is then override with specific logic if target is not None: # override for Tools/LmbrSetup folder if target in lmbr_override_target_map: output_paths = [ self.get_lmbr_setup_tools_output_folder( platform, configuration) ] if ctx is None: ctx = self # if no overwrite provided if len(output_paths) == 0: # check if output_folder is defined output_paths = getattr(ctx, 'output_folder', None) if output_paths: if not isinstance(output_paths, list): output_paths = [output_paths] # otherwise use default path generation rule else: output_paths = [ self.get_output_target_folder(platform, configuration) ] output_nodes = [] for path in output_paths: # Ensure output casing matches project configuration to prevent case-sensitive WAF methods from evicting nodes parent_path, dir_name = os.path.split(os.path.abspath(path)) if os.path.exists(path) and dir_name not in os.listdir(parent_path): try: os.rename(path, path) except: warning = '[WARN] Unable to modify output path (possibly due to an output file being open). ' \ 'This warning can be ignored if displayed output path casing matches what is on disk: {0}'.format(path) Logs.warn_once(warning) # Correct handling for absolute paths if os.path.isabs(path): output_nodes.append(self.root.make_node(path)) else: # For relative path, prefix binary output folder with game project folder output_nodes.append(self.launch_node().make_node(path)) return output_nodes