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:
parent
612782a33d
commit
e3237cd3b5
@ -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
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Sealed with Magistamp.
|
// Sealed with Magistamp.
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ impl Stamper
|
|||||||
{
|
{
|
||||||
if let Ok(content) = read_to_string(path)
|
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
|
return; // Already has a header
|
||||||
}
|
}
|
||||||
@ -55,7 +56,7 @@ impl Stamper
|
|||||||
println!("🪄 Magistamp: sealing {} with SPDX protection...",
|
println!("🪄 Magistamp: sealing {} with SPDX protection...",
|
||||||
path.display());
|
path.display());
|
||||||
|
|
||||||
let new_content = format!("{SPDX_HEADER}{content}");
|
let new_content = format!("{STAMP}{content}");
|
||||||
if let Err(e) = write(path, new_content)
|
if let Err(e) = write(path, new_content)
|
||||||
{
|
{
|
||||||
eprintln!("Failed to write to {}: {}", path.display(), e);
|
eprintln!("Failed to write to {}: {}", path.display(), e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user