import os
from pathlib import Path


class Ammo:
    def __init__(self, name, path):
        """
        attention! NoneObject presents (NoneAmmo)
        """
        self.name = name
        self._path = path

    @classmethod
    def from_content(cls, name, path, content):
        Path(path).write_bytes(content)
        return cls(name, path)

    @property
    def abs_path(self):
        return os.path.abspath(self._path)
