Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions Perforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def GetUserFromClientspec():
def GetClientRoot(in_dir):
# check if the file is in the depot
command = ConstructCommand('p4 info')
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=in_dir, shell=True)
result, err = p.communicate()
result = result.decode("utf-8")
err = err.decode("utf-8")
Expand All @@ -108,7 +108,7 @@ def GetClientRoot(in_dir):
# sometimes the clientspec is not displayed
sublime.error_message("Perforce Plugin: p4 info didn't supply a valid clientspec, launching p4 client");
command = ConstructCommand('p4 client')
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=in_dir, shell=True)
result, err = p.communicate()
return -1

Expand Down Expand Up @@ -230,7 +230,7 @@ def AppendToChangelistDescription(changelist, input):

def PerforceCommandOnFile(in_command, in_folder, in_filename):
command = ConstructCommand('p4 {0} "{1}"'.format(in_command, in_filename))
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=global_folder, shell=True)
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=in_folder, shell=True)
result, err = p.communicate()
result = result.decode("utf-8")
err = err.decode("utf-8")
Expand Down Expand Up @@ -296,7 +296,7 @@ def on_modified(self, view):
return

if(view.is_dirty()):
success, message = Checkout(view.file_name())
success, message = Checkout(os.path.realpath(view.file_name()))
LogResults(success, message);

def on_pre_save(self, view):
Expand All @@ -307,7 +307,7 @@ def on_pre_save(self, view):
return

if(view.is_dirty()):
success, message = Checkout(view.file_name())
success, message = Checkout(os.path.realpath(view.file_name()))
LogResults(success, message);

class PerforceCheckoutCommand(sublime_plugin.TextCommand):
Expand All @@ -330,9 +330,6 @@ def on_pre_save(self, view):
if view.file_name() and os.path.isfile(view.file_name()):
return

global global_folder
global_folder, filename = os.path.split(view.file_name())

perforce_settings = sublime.load_settings('Perforce.sublime-settings')

self.preSaveIsFileInDepot = 0
Expand Down