Retrieve the specified license as a dict or return a placeholder if not set. If root is specified and the license file is not already RTF, converts it to RTF with a readable font (Segoe UI) instead of relying on Briefcase's default Courier. :param root: Payload directory to write the c
(info, root: Path = None)
| 154 | |
| 155 | |
| 156 | def get_license(info, root: Path = None): |
| 157 | """Retrieve the specified license as a dict or return a placeholder if not set. |
| 158 | |
| 159 | If root is specified and the license file is not already RTF, converts it to RTF |
| 160 | with a readable font (Segoe UI) instead of relying on Briefcase's default Courier. |
| 161 | |
| 162 | :param root: Payload directory to write the converted RTF file to. |
| 163 | """ |
| 164 | if "license_file" in info: |
| 165 | license_path = Path(info["license_file"]) |
| 166 | # If already RTF or no root to write to, return as-is |
| 167 | if license_path.suffix.lower() == ".rtf" or root is None: |
| 168 | return {"file": str(license_path)} |
| 169 | # Convert txt to rtf with better font |
| 170 | rtf_path = root / "LICENSE.rtf" |
| 171 | rtf_path.write_text(txt_to_rtf(license_path.read_text(encoding="utf-8")), encoding="utf-8") |
| 172 | return {"file": str(rtf_path)} |
| 173 | |
| 174 | placeholder_license = Path(__file__).parent / "nsis" / "placeholder_license.txt" |
| 175 | return {"file": str(placeholder_license)} # convert to str for TOML serialization |
| 176 | |
| 177 | |
| 178 | def is_bat_file(file_path: Path) -> bool: |