Adjusted the SPDX Header and made a STAMP constant

The SPDX_HEADER constant was changed to the STAMP constant and the
SPDX_HEADER is now "// SPDX-License-Identifier:".
This commit is contained in:
Myrddin Dundragon 2025-06-24 22:12:31 -04:00
parent 612782a33d
commit e3237cd3b5

View File

@ -7,7 +7,8 @@ use std::{fs, io};
const SPDX_HEADER: &str = "\
const SPDX_HEADER: &str = "// SPDX-License-Identifier:";
const STAMP: &str = "\
// SPDX-License-Identifier: Apache-2.0
// Sealed with Magistamp.
@ -47,7 +48,7 @@ impl Stamper
{
if let Ok(content) = read_to_string(path)
{
if content.starts_with("// SPDX-License-Identifier:")
if content.starts_with(SPDX_HEADER)
{
return; // Already has a header
}
@ -55,7 +56,7 @@ impl Stamper
println!("🪄 Magistamp: sealing {} with SPDX protection...",
path.display());
let new_content = format!("{SPDX_HEADER}{content}");
let new_content = format!("{STAMP}{content}");
if let Err(e) = write(path, new_content)
{
eprintln!("Failed to write to {}: {}", path.display(), e);