Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import os
- class Context:
- def __init__(self):
- self.netbeans="~/netbeans-7.2beta/bin/netbeans"
- self.context_dir = ".contexts"
- def open(self, context):
- self.context_file = self.context_dir + "/" + context
- print self.context_file
- f = open(self.context_file, 'r')
- args = f.read().replace("\n", ' ')
- os.system(self.netbeans+ " " + args)
- def exists(self, context):
- self.context_file = self.context_dir + "/" + context
- return os.path.exists(self.context_file)
- def create(self, context):
- if(False == os.path.exists(self.context_dir)):
- os.mkdir(self.context_dir)
- filename = self.context_dir + "/"+ context
- f = open(filename,"w")
- input = raw_input("Ingrese archivos: ")
- f.write(input)
- f.close()
- argv1 = sys.argv[1]
- c = Context()
- if(argv1):
- if(c.exists(argv1)):
- c.open(argv1)
- else:
- c.create(argv1)
Add Comment
Please, Sign In to add comment